25.39. DO

[<<<] [>>>]

This command is a looping construct that repeats commands so long as long the condition following the keyword UNTIL becomes true or the condition following the keyword WHILE becomes false.

The format of the command is

DO
 ...
 commands to repeat
 ...
LOOP WHILE expression

or

DO
 ...
 commands to repeat
 ...
LOOP UNTIL expression

The condition expression is evaluated every time after the loop commands were executed. This means that the loop body is executed at least once.

A DO/LOOP construct should be closed with a LOOP UNTIL or with a LOOP WHILE command but not with both.

The DO/LOOP UNTIL is practically equivalent to the REPEAT/UNTIL construct.

See also WHILE, DOUNTIL, DOWHILE, REPEAT, DO and FOR.


[<<<] [>>>]