While

Conditionally and/or repeatedly executes a series of statements.

Syntax:

While continuation-condition

series 

of 

statements 

EndWhile

Parameters:

(s) continuation-condition an expression to be evaluated.

(s) series of statements statements to be executed repeatedly until the condition following the While keyword evaluates to @FALSE.

 

The While statement causes a series of statements to be repeatedly executed until the continuation-condition evaluates to zero or @FALSE. The test of the continuation-condition takes place before each execution of the loop. A While loop executes zero or more times, depending on the continuation-condition.

The following statements affect continued execution:

 Break Terminates the While structure and transfers control to the statement following the next matching EndWhile.

 Continue Returns to the While statement and re-evaluates the expression.

 EndWhile Returns to the While statement and re-evaluates the expression.

 

Note:  EndWhile and "End While" may be used interchangeably.

Example:


a=10
While a>5
   Display(3, "The value of a is now", a)
   a=a-1
EndWhile
Message("The value of a should now be 5",a)

See Also:

If, For, GoSub, Switch, Select