The while Statement [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Reference Manual
The while Statement
The while statement evaluates an expression and executes the loop body
until the expression evaluates to false.
Syntax
while (expression)
statement
Description
The controlling expression is evaluated at run time. If the controlling
expression has a nonzero value, the loop body is executed. Then control
passes back to the evaluation of the controlling expression. If the
controlling expression evaluates to 0, control passes to the statement
following the loop body. The test for 0 is performed before the loop
body is executed. The loop body of a while statement with a controlling
constant expression that evaluates to 0 never executes.
Example
i = 0;
while (i < 3) {
func (i);
i++;
}
The example shown above calls the function func three times, with the
argument values of 0, 1, and 2.
MPE/iX 5.0 Documentation