Syntax
Repeats a block until a condition becomes true. The condition is tested after each pass, so the body runs at least once.
REPEAT
<statements>
UNTIL <condition>Also written : UNTIL
Parts
| <statements> | The body of the loop. |
|---|---|
| <condition> | Any expression, tested after each pass. The loop stops when it is true. |
Good to know
- The loop stops when the condition is true, not when it is false: it is the opposite of WHILE.
DO … LOOP UNTILdoes not exist. WriteREPEAT … UNTIL.CONTINUEinside a REPEAT tests the condition before the next pass.
Example
tries = 10REPEAT tries = tries + 1UNTIL tries > 5Console(Str(tries)) ' 11In the manual : Control flow