WHILE/WEND executes a loop as long as a specified condition evaluates to TRUE.

These two statements comprise the start and end of a control loop.  Between the WHILE and WEND code is placed (optionally) that is executed repeatedly while expression evaluates to true.  The code between any WHILE statement and its associated WEND statement will not execute even once if the WHILE expression initially evaluates to false.  Once execution reaches the WEND statement, for as long as the WHILE expression evaluates to true, then execution will jump back to the WHILE statement.  "Expression" can be a boolean, numeric, or string expression or combination of expressions.

Note: A program SHOULD NOT exit a WHILE...WEND loop using GOTO.

GOSUB, FUNCTION and SUB may be used within a WHILE...WEND loop because they only temporarily redirect program flow or call on other parts of the program. Program execution resumes within the WHILE/WEND loop in these instances.  Program execution does not return to the WHILE/WEND loop if GOTO is used within the loop.  GOTO should not be used to exit a WHILE/WEND loop.

EXIT WHILE will correctly exit the loop before it would have terminated normally.
