Next: , Previous: , Up: Statements   [Contents][Index]

7.7 WHILE-DO Statement

The WHILE-DO statement repeats a statement while a condition, tested at the start of the loop, is met.

WHILE expr DO statement

The condition expr is evaluated. If its value is zero (i.e., the condition is false), then the WHILE-DO statement does nothing and control flow passes on to the next statement. If the condition is non-zero (i.e., the condition is true), then the statement statement is executed and the condition is re-evaluated, iterating until the condition becomes true.