for Repetition Statement
The general form of the for repetition statement is
The initialization names the loops control variable and provides its initial value, condition determines whether the loop should continue executing and increment modifies the control variable's value (possibly an increment or decrement) so that the loop-continuation condition eventually becomes false. All three expressions in a for statement are optional. If the condition is omitted, Java assumes that the loop-continuation condition is always true, thus creating an infinite loop. The initialization expression may be omitted if the program initializes the control variable before the loop. The increment expression may be omitted if the program calculates the increment with statements in the loop's body or if no increment is needed. |
Loops while do...while for Control Structure Loop Design Methodology Common Loop Errors |
|
Next >> | ||
Fook Yuen Sin - Team 1 |