Iteration statements
while
   while (expression)
        statement
This sequence is followed repetitively:
- 
expression is evaluated.
 
- 
If expression is non-zero, statement is executed.
 
- 
If expression is zero, statement is not executed,
and the repetition stops.
expression
must have scalar type.do-while 
   do
        statement
   while (expression);
This sequence is followed repetitively:
- 
statement is executed.
 
- 
expression
is evaluated.
 
- 
If
expression
is zero, repetition stops.
(do-while tests loop at the bottom;
while tests loop at the top.)for
   for (expression1; expression2; expression3)
        statement
- 
expression1 initializes the loop.
 
- 
expression2 is tested before each iteration.
 
 
- 
If expression2 is true:
 
- 
statement is executed.
 
- 
expression3 is evaluated.
 
- 
Loop until expression2 is false (zero).
 
 
- 
Any of expression1, expression2,
or expression3 may be omitted, but
not the semicolons.
 
- 
expression1
and
expression3
may have any type;
expression2
must have scalar type.
Next topic: 
Jump statements
Previous topic: 
switch
© 2003 Caldera International, Inc.  All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003