Command: while

Syntax

while (<condition>)
    <command_block>

Description

Execute a command or block of commands while a condition has a true value.

Parameters

Switches

 None

Notes

Any non-zero numeric or point, or any non-null string is considered true when evaluating <condition>.

A jump to the end of the while loop block may be made with a continue command.

A break out of the while loop block may be made with a break command.

Examples

Execute one command in a while loop.

x = 1
while ( array[x] < 10 ) x = x + 1

Execute a command block in a while loop.

numeric x = 0
while ( x < 5 ) {
    x = x + 1
    y = y * sqrt(x)
}

See Also

Commands:

break, continue, do, until

Identifiers:

cond_precision (numeric)