Break and Continue
break leaves the loop, continue skips to the next round. A label lets you break out of nested loops.
Example
for (int i = 1; i <= 6; i++) {
if (i == 2) continue;
if (i == 5) break;
System.out.println(i);
}Result
1 3 4
Exercise
Skip to the next round.
if (i == 2) ;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.