LOOP


The LOOP construct allows the programmer to specify loops with multiple exit conditions.

 

COMMAND SYNTAX

LOOP statements1 WHILE|UNTIL expression DO statements2 REPEAT

 

SYNTAX ELEMENTS

statements1 and statements2 consist of any number of standard statements include the LOOP statement itself, thus allowing nested loops. statements1 will always be executed at least once, after which the WHILE or UNTIL clause is evaluated.

expression is tested for Boolean TRUE/FALSE by either the WHILE clause or the UNTIL clause. When tested by the WHILE clause statements2 will only be executed if expression is Boolean TRUE. When tested by the UNTIL clause, statements2 will only be executed if the expression evaluates to Boolean FALSE.

REPEAT causes the loop to start again with the first statement following the LOOP statement.

 

NOTES

See also BREAK, CONTINUE

 

EXAMPLES

LOOP WHILE B < Max DO
    Var<B> = B++ *6
REPEAT

 

LOOP
    CRT "+":
WHILE READNEXT KEY FROM List DO
    READ Record FROM FILE, KEY ELSE CONTINUE
    Record<1> *= 6
REPEAT
CRT


jBC