Next / Previous / Contents / TCC Help System / NM Tech homepage

14.4. The while construct: looping

To execute a section of the program repeatedly:

while E:
    Bt
else:
    Bf

The else: part is optional. Here's how the statement is executed:

  1. Evaluate the expression E. If that expression is false, go to Step 3. Otherwise go to Step 2.

  2. Execute block Bt, and then return to Step 1.

  3. If there is an else: block Bf, execute it, otherwise do nothing.