HP 3000 Manuals

The do Statement [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Reference Manual

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.



MPE/iX 5.0 Documentation