HP C/iX Reference Manual (31506-90011)
Chapter 6 91
Statements
The do Statement
The do Statement
The do statement executes the loop body one or more times until the expression in the
while clause evaluates to 0.
Syntax
do
statement
while (
expression
)
Description
The loop body is executed. The controlling expression is evaluated. If the value of the
expression is nonzero, control passes to the first statement of the loop body. Note that the
test for a zero value is performed after execution of the loop body. The loop body executes
one time regardless of the value of the controlling expression.
Example
i=0;
do {
func (i);
i++;
} while (i<3);
This example calls the function func three times with the argument values of 0, 1, and 2.