Iteration statement
syntax:
- while ( <expression> ) <statement> <next statement>
semantic:
- if <expression> is nonzero (true), then <statement> is executed, and control is passed back to the beginning of the while loop i.e.. <statement> is executed repeatedly until <expression> is zero (false), at that point control passes to <next statement>
example: while (i <= 10) { sum += i; ++I;}
syntax:
- for ( <expr1> <expr2> <expr3> ) <statement> <next statement>
semantic:
- Is equivalent to <expr1>
while <expr2> {
<statement>
<expr3> }
<next statement>