Use the WHILE statement to test a condition and execute statements within
the body of the WHILE loop as long as the condition is true.
For condition syntax see IF prompt statement.
Example
WHILE var1 < 10 DO
.
.
.
var1 = var1 + 1;
ENDWHILE
As long as the value of var1 is less than 10, the statements
will execute.
Procedure
Use the following procedure to define a WHILE statement:
- Selecting the WHILE statement: Click Statements —> Conditional.
The system displays the Condition Definition
window.
- Click the button next to WHILE Condition DO, then click condition.
The system displays the Condition Definition window.
- Defining the condition: To define the condition,
follow Steps 3 through 7 in the procedure for IF prompt statement.
- Adding the statement to the prompt: Click OK.
The WHILE statement is added to the prompt.
- Defining DO statements: Use the Statements menu to define the statement that you want to execute when
the WHILE condition is true.
- The statement is added to the prompt following the DO keyword.
- Repeat Step 5 for each statement to
be performed when the WHILE condition is true.