WHILE Statement

Used in conjunction with a FOR or LOOP statement to exit the loop.

Syntax

WHILE limit-expr {DO}

Syntax Elements

limit-expr is an expression that evaluates to true or false (1 or 0). It can be similar to the test expression in the IF statement, or a READNEXT or READPREV statement.

Operation

Refer to the descriptions of the FOR and LOOP statements.

Examples

J=0
LOOP
PRINT J
J=J+1
WHILE J<4 DO REPEAT

Prints sequential values of J from 0 through 3 (loop executes 4 times).

LOOP WHILE READNEXT ID FROM SV SETTING ERROR DO
PRINT ID
REPEAT

Prints all the item-ids in the list SV. Any file error code is assigned to variable ERROR. The program terminates when the list is exhausted.