| Syntax Color Legend |
|---|
| Command |
| Mandatory parameter |
| Optional parameter |
| Mandatory keyword |
| Optional keyword |
LOOP WHILE <condition>
<Code lines>
ENDLOOP
Executes the code in the loop until the <condition> evaluates False.
None
| Parameter | Description |
|---|---|
| <Condition> | Expression evaluating to True or False |
| <Code lines> | Code that is performed each time the loop is executed. The loop will be terminated immediately in one of the following cases:
|
The evaluation of the condition is performed at the start of each loop. Therefore 'LOOP WHILE False' will execute never and 'LOOP WHILE True' will result in an endless loop.
i := 1
loop while i <= 5
sme ('I is: ' + format (i, onezero))
i += 1
endloop
i := 1
run := True
loop while run
sme ('I is: ' + format (i, onezero))
i += 1
if i > 5
run := False
endif
endloop