Execution of the WHILE Statement

The iterative WHILE statement is executed as follows: the Boolean expression is evaluated and, if the result is TRUE, the statement following DO is executed. This sequence of events continues until the value of the Boolean expression is FALSE or until the statement following DO transfers control outside the WHILE statement.

WHILE-DO Loop illustrates the WHILE-DO loop.

Figure 9. WHILE-DO Loop

WHILE-DO Loop