for loop
for ( int i = 0; i < N, i++) { /* (intex initialisation; condition; step) */
...; /* statements */
}
- the step can be negative:
i--; or more than 1: i += step
- the scope of the index variable is only within the block
- they can be nested
while loop
while (condition) {
...; /* statements */
}
do-while loop
do {
...; /* statements */
} while (condition) ;
- note that the body is executed at least once as the condition is executed after the body
control statements
- change the normal flow of execution
| statement |
function |
continue |
skips the remaining statements in the body of the loop |
break |
immediately terminates the loop |
goto [location] |
jumps to the specified location |