WHILE – WEND

The WHILE-WEND control structure is a loop with an initial query. It is executed as long as the condition is fulfilled. If the first test returns ‘false’, the program execution never reaches the program code within the loop and skips this part.

The syntax is

WHILE condition
… statements …
WEND

The condition is a logical comparison in the form expression logical operator expression.

The BREAK control command can be used to exit the loop immediately.

The CONTINUE control command starts the next iteration immediately.

Example

A = 1
WHILE A < 10
PRINT A, A * A, A * A * A
A = A + 1
TURN