While Loop

A “while” loop continually repeats its body until expression evaluates to a false value.

While expression

code to repeat (aka: the loop's body)

End

An example that asks the user to enter a number until they choose a value greater than one:

$number = 0

While $number <= 10

$number = Prompt Input "Enter a number bigger than 10 to stop:", "", "OK"

End

The condition is initially true, since the number is initialized to zero, which is less than 10. That means the loop’s body will always execute at least once, asking the user to input a number. The user’s number is then evaluated by the condition, testing whether or not to continue the loop.


Previous Chapter
Loops
<<  index  >>
 
Next Chapter
For Loop