While... End While
Use this command to repeat a series of instructions until the specified condition is no longer true.
The While command tests the initial condition first. If it equals zero, your system does not carry out the instructions.
Before running the While command, specify the initial value of the variable as zero or non-zero. Somewhere in the loop, change the value of the variable. This process continues until the value of the variable reaches zero.
Syntax:
WHILE <Conditions>
Instructions
END WHILE
where:
- Instructions is a set of instructions to be repeated as long as the logical value of the variable is not false (that is, not zero).
- Conditions are any of the following;
Value Description AND
When each of several conditions must be true.
OR
When one of several conditions must be true.
EQ
Equal to.
GE
Greater than or equal to.
GT
Greater than.
LE
Less than or equal to.
LT
Less than.
NE
Not equal to.
Syntax example:
CREATE VARIABLE Loop AS NUM
SET VARIABLE Loop = 1
WHILE $Loop$
<commands to execute>
SET VARIABLE Loop = $Loop$ + 1
IF $Loop$ = 10
SET VARIABLE Loop = 0
END IF
END WHILE
See also