Begins a WHILE ... END-WHILE loop.
WHILE logical_expression
The general format of WHILE is as follows:
A valid logical expression. See LET for a description of logical expressions.
See Bit-Wise Operators for information on the bit-wise operators supported by WHILE.
The WHILE loop continues until the condition being tested is FALSE.
An expression returning 0 (zero) is considered FALSE; an expression returning nonzero is TRUE.
BREAK causes an immediate exit of the WHILE loop; Production Reporting continues with the command immediately following END-WHILE.
CONTINUE ends the current iteration of a loop. Program control passes from the CONTINUE parameter to the end of the WHILE loop body.
WHILE commands can be nested to any level and can include or be included within IF and EVALUATE commands.
The following example shows an IF nested within a WHILE:
while #count < 50 do get_statistics if #stat_count = 100 break ! Exit WHILE loop. end-if add 1 to #count end-while
You can use single numeric variables in your expression to make your program more readable, for example when using flags.
The following example sets up an infinite loop:
You can use any complex expression in WHILE as shown in the following example:
The following example shows the use of CONTINUE in a WHILE loop:
while #count < 50 if #count = 10 continue end-if do get-statistics(#count) add 1 to #count end-while
LET for a description of expressions