> lang > do | ![]() |
Previous Next Edit Rename Undo Refresh Search Administration
| Documentation |
|
DO [ WHILE Condition ] . . . [ BREAK | CONTINUE ] . . . LOOP [ UNTIL Condition ]
Repeats a number of statements while the initial condition remains true or until the final condition becomes true. If neither WHILE nor UNTIL is used, the loop becomes an endless loop that can only be exited via the BREAK statement. If the break statement is missing in such a case, it becomes an infinite loop, a condition that is almost universally undesirable.
| Part | Description |
|---|---|
| DO | Always the first statement of the loop. |
| WHILE | If used, states a Condition that must remain true to execute the loop. |
| UNTIL | If used, states a Condition that has to become true to stop execution of the loop. |
| Condition | Any boolean expression. |
| BREAK | Immediately jumps out of the loop and continues execution of the program with the next line after the loop. |
| CONTINUE | Immediately leaves out all following statements in the loop and jumps to the end of the loop causing it to start all over again. |
| LOOP | Always the last statement of the loop. |