Next: DO-WHILE Statement, Previous: REPEAT Statement, Up: Statements [Contents][Index]
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.