ICSE Class 10 Computer Applications
Question 13 of 22
Nested for loops — Question 13
Back to all questions 13
Question Question 3(ii)
Distinguish between the following:
continue statement and labelled continue statement
| continue statement | labelled continue statement |
|---|---|
| continue statement is used to skip the current iteration of a loop and move on to the next iteration. | A labelled continue statement skips the current iteration of an outer loop by using a label before the loop and including the same label in continue statement. |
Syntax:continue; | Syntax:continue <label>; |
| For example, for (int i = 0; i <= 3; i++) { System.out.println("i =" + i); for(int j = 0; j < 3; j++) { if (i == 2) { continue; } System.out.print("j = " + j + " "); } System.out.println(); } | For example, outerLoop: for (int i = 0; i <= 3; i++) { for(int j = 0; j < 3; j++) { if (i == 2) { continue outerLoop; System.out.println("i =" + i +" ; j =" + j); } } } |