Description
The REPEAT
instruction has the effect that a sequence of instructions
is executed repeatedly (at least once), until its related Boolean
condition is 1 (true).
The UNTIL
instruction
marks the end condition.
The occurrence may be terminated early
using the EXIT
.
The END_REPEAT
instruction marks the end of the instruction(s).
In the following cases REPEAT
may not be used
as it can create an endless loop which causes the program to crash:
REPEAT
may not be used for synchronization between processes, e.g., as a "Waiting Loop" with an externally defined end condition.REPEAT
may not be used in an algorithm, such as the completion of the loop end condition or execution of anEXIT
instruction cannot be guaranteed.
Example REPEAT...UNTIL...END_REPEAT
x := -1;
REPEAT x := x + 2;
UNTIL x >= 101
END_REPEAT;