The UNTIL statement is used in conjunction with the FOR / NEXT or LOOP / REPEAT constructs to determine whether execution of the loop should continue.
IF expr # 0 THEN EXIT
If the CONDITIONAL.STATEMENTS option of the $MODE compiler directive is active, expr may be one of the following statements that in its normal form has a THEN/ELSE clause:
FILELOCK, FILEUNLOCK, FIND, FINDSTR, FLUSH, GETLIST, LOCATE, MATREAD, MATREADCSV, MATREADL, MATREADU, OPEN, OPENPATH, OPENSEQ, OSREAD, READ, READBLK, READCSV, READL, READLIST, READNEXT, READSEQ, READU, READV, READVL, READVU, SEEK, WRITEBLK, WRITECSV, WRITESEQ
When used in this way, the LOCKED or ON ERROR clauses normally associated with some of these statements are not available.
FOR I = 1 TO 20
UNTIL A(I) < 0
This program fragment displays elements of matrix A. The loop terminates if an element is found with a negative value.
UNTIL OSREAD 'C:\FAX.DATA'
The above program fragment, which requires the CONDITIONAL.STATEMENTS option of the $MODE compiler directive to be active, repeatedly attempts to read the C:\FAX.DATA file at five minute intervals. When successful, the loop exits.