The LOOP construct allows the programmer to specify loops with multiple exit conditions.
LOOP statements1 WHILE|UNTIL expression DO statements2 REPEAT
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.