UD70
Issue code: 70nu2
Reference 7-11
DO WHILE
Syntax 1
DO WHILE Conditional expression
Instruction
LOOP
Syntax 2
DO
Instruction
LOOP WHILE Conditional expression
Syntax 3
DO WHILE Conditional expression LOOP
This is a loop or iterative instruction which causes a block of instructions to
be repeated until a specific expression becomes false.
Syntax 1Syntax 1 allows the conditional expression be evaluated first. If the
outcome is true, the instructions are executed. The program will continue
in the loop until the conditional expression becomes false.
Syntax 2Syntax 2 allows the instructions be executed first, the conditional
expression is evaluated. This ensures that the instructions in the loop are
executed at least once.
Syntax 3Syntax 3 is identical to Syntax 1, except there are no executing instructions
in the loop.
Example 1
DO WHILE #1.21 < 1000
#1.21 = #1.21 + 1
LOOP
Example 2
DO
a = a + 0.001
LOOP WHILE a < 6
Example 3
DO WHILE #3.02 > 10 LOOP
(If the value of #3.02 is greater than 10, the program will continue to loop.)
EXIT
Syntax
EXIT
This is a flow-control instruction which provides a quick method of
terminating the current task.
Example
CLOCK{
IF #18.22 = 1 THEN EXIT
...
(If the value of #18.22 is 1, exit from the rest of the
CLOCK task.)