LOOP / REPEAT |
![]() ![]() ![]() |
The LOOP statement introduces a sequence of statements to be executed repeatedly.
Format
LOOP {statement(s)} {WHILE expr} {UNTIL expr} {statement(s)} REPEAT
where
There may be any number of WHILE or UNTIL statements within the loop appearing at any position relative to other statements.
Execution of the statements within the loop continues repeatedly until either the expression associated with a WHILE statement evaluates to zero or the expression associated with an UNTIL statement evaluates to a non-zero value.
The loop may also be terminated by an EXIT statement as detailed in its own description.
The CONTINUE statement may be used to commence the next iteration of the loop without execution of any intervening statements.
Example
LOOP REMOVE ITEM FROM ITEM.LIST SETTING DELIMITER DISPLAY "Item id " : ITEM WHILE DELIMITER REPEAT
This program fragment displays the elements of the dynamic array ITEM.LIST.
See also: |