June 2017
Beginner
1296 pages
69h 23m
English
... is executed and the loop-continuation test is evaluated. Figure L.2 uses a labeled continue statement in a nested for to enable execution to continue with the next iteration of the outer for.
The labeled for (lines 5–19) starts at the nextRow label. When the if at line 13 in the inner for detects that column is greater than row, the continue statement at line 14 executes, and program control continues with the increment of the control variable row of the outer for loop. Even though the inner for counts from 1 to 10, the number of * characters output on a row never exceeds the value of row, creating an interesting triangle pattern.
continue statement terminating a nested for statement.
1 // Fig. L.2: ContinueLabelTest.java
Read now
Unlock full access