While Statement

Executes Statements repeatedly while the specified bool-exp is True.

Syntax

While bool-exp [Do]

Statements

Endwhile

Comments

ATEasy first evaluates the bool-exp. If the result is zero, the control is transferred to the statement that follows the Endwhile. Otherwise, Statements are executed and the While...Endwhile statement is executed again. The Do statement is optional.

Example

i=0

While i < 2

i=i+1

Print i;

EndWhile

! i is now 2

! This will print 1 2

See Also

Continue, Exitloop, Expressions, For, Loop, Repeat