|
| |
for
- a 3 in 1 "package deal" for repetitions:
-
- for ( <init_exp> ; <condition> ; <end_exp> )
- {
- <statement>
- }
- init_exp is an expression to be executed before the loop;
- condition is tested at the end of
each iteration
- end_exp is an expression executed at
the end of each iteration
Equivalence of "for" and "while".
- <init_exp> ;
- while ( <condition> )
- {
-
- <statement>
-
- <end_exp>
- }
Example:
|