WHILE Statement |
WHILE statements provide a means of repeating blocks of code a variable number of times, depending on the conditions that the blocks are run under.
WHILE condition_A do_A
condition_A | Some logic expression that can be evaluated to give a boolean result. |
do_A | The code to execute while condition_A is true. In most cases, do_A will change condition_A at some point to make it false, breaking the loop. |
The following example sums each of the integers between 0 and 9.
$counter = 0; WHILE $counter < 9 BEGIN $sum = $sum + counter; $counter = $counter + 1; END