while: While loop

Package: language

Syntax

while (expression) statement

Elements

while
Required keyword.
expression
A boolean valued expression tested before each iteration.
statement
A statement (possibly compound) to be executed in each iteration of the loop.

Description

The while loop executes the enclosed statements while the specified condition is true.

Examples

1. An infinite loop.

while (yes) {
    sleep 30
    time
}

2. Type a file.

list = "home$login.cl"
while (fscan (list, line) != EOF)
    print (line)

See also

for, case, break, next