The REPEAT...UNTIL statement repeats its subject statement(s) until an expression evaluates to true. The condition is checked after the subject statement is executed. Therefore, the subject statement is always executed at least once, even if the expression evaluates to true the first time.
| Note |
REPEAT statement UNTIL expression
or
REPEAT BEGIN
statements
ENDREP UNTIL expression
This example shows that because the subject of a REPEAT statement is evaluated before the expression, it is always executed at least once:
i = 1 REPEAT BEGIN PRINT, i ENDREP UNTIL (i EQ 1)
Introduced: Original