Consider the following code:
A while (B) { C D if (E) { F break; } G } H I J
Assume the loop ends because the test condition of the loop is false on iteration 2. Write out the the order in which the statements will execute.
Assume the loop ends because the test condition of the loop is false on iteration 3. Write out the the order in which the statements will execute.
Order:
A B C D E F G B C D G H I J
Order:
A B C D E F G B C D E F G B C D G H I J
Translate the following natural language description of a loop into a for loop:
Declare a variable namedeof typeshort, initialized to84. Then, untileis greater thanhiWunch, incremente.
for (short e = 84; e >= hiWunch; e++) {
...
}
Something to double-check in your solution:
e >= hiWunch)?Related puzzles: