|
WHILE Statement |
Top Previous Next |
|
Executes a series of statements as long as a given condition is TRUE.
Syntax
WHILE condition
[statements]
ENDWHILE
condition Expression that evaluates to TRUE or FALSE.
statements One or more statements executed while condition is True.
If condition is TRUE, all statements are executed until the ENDWHILE statement is encountered. Control then returns to the WHILE statement and condition is again checked. If condition is still TRUE, the process is repeated. If it is not TRUE, execution resumes with the statement following the ENDWHILE statement.
Unlike the FOR statement, the WHILE statement evaluates condition on every loop pass.
Example
VARIABLES: a TYPE: Integer
WHILE ( a > 0 ) print "a = ", a a = ( a - 1 ) ENDWHILE
|