Skip to content

While

Looping statements specify certain statements to be executed repeatedly.

A While statement contains a Boolean expression that controls the repeated execution of a list of statements. The list of statements is terminated by a Loop command.

Syntax

The syntax of a While statement is:

While {Boolean-expression}
    {statement 1}
    {statement 2}{statement n}
Loop

The Boolean expression controlling the repetition is evaluated before the statements are executed. The contained statements are executed as long as the expression is True. If the expression is False at the beginning, then the statements are not executed at all.

Example

An example of a While statement is:

// Initialize the variables
Move "" To sName
Move "" To sList

// Loop until Fred's name is entered
While (sName <> "Fred")
    Move (GetNextName()) to sName   // Retrieve the next name
    Move (sList + ";" + sName) To sList
Loop