UNTIL |
![]() ![]() ![]() |
The UNTIL statement is used in conjunction with the FOR / NEXT or LOOP / REPEAT constructs to determine whether execution of the loop should continue.
Format
UNTIL expr
where
The UNTIL statement causes execution of the innermost FOR/NEXT or LOOP/REPEAT construct to terminate if the value of expr is non-zero. It is equivalent to a statement such as
IF expr # 0 THEN EXIT
Example
FOR I = 1 TO 20 UNTIL A(I) < 0 DISPLAY A(I) NEXT I
This program fragment displays elements of matrix A. The loop terminates if an element is found with a negative value.
See also: |