REPEAT statement

Language reference ›› Statements ››
Parent Previous Next

repeat-statement = REPEAT { block } UNTIL boolean-expression .

The REPEAT statement is optimized for boolean use, but in non-strict mode PMP also accepts a non-boolean expression: any value that is not zero is evaluated as TRUE (1).


Optimizations:


If <boolean-expression> evaluates to a value of 0 (FALSE), no code is generated for the <boolean-expression> evaluation and the <block> does not loop.

If <boolean-expression> evaluates to a value not equal to 0 (TRUE), no code is generated for the <boolean-expression> evaluation and the <block> loops forever.


The loop flow may also be controlled via BREAK and CONTINUE statements.


See also: BREAK, CONTINUE.