A good answer might be:All three aspects of controling the loop,
| |||
Declaring the Loop Control VariableBut there is another (smaller) aspect of loop control, and that is declaring the loop control variable. For example, here is a counting loop:
The loop control variable count is declared somewhere else in
the program (possible many statements away from the
In this example, the declaration of count and its initialization have been combined. However, there is an important difference between this program fragment and the previous one:
Important Note: a variable declared in a
The following is NOT correct:
Since the println statement is not part of the loop body, it cannot use count. | |||
QUESTION 2:Is the following code fragment correct?
|