|
B.4 Looping
|
loop-related features
- do/loop -- beginning and end of an infinite loop block
- do/end do -- beginning and end of a one iteration loop block
- exit do -- get out of a loop block
- repeat do -- repeat the code within the loop block
- while xxx -- where xxx evaluates to TRUE or FALSE, loops while xxx is true
- until xxx -- where xxx evaluates to TRUE or FALSE, loops until xxx is true
Both
while and
until can occur anywhere within a loop and can occur
more than once.
- for varname = start_value to end_value / next varname
- for varname = start_value to end_value step step_value / next varname
- repeat for -- repeat the current iteration -- the varname is not adjusted
- iterate for -- start the next iteration
- exit for -- get out of this for/next block
The
while and
until statements can appear anywhere inside of a
do/loop and can even appear multiple times with different conditions.