break inside a switch inside a loop
A plain break in a switch only leaves the switch. continue rows skips straight to the next row, so only row 3 reaches its last line.
break leaves a loop (or switch) immediately, continue skips the rest of the current iteration and moves on to the next one, and a label lets either of them act on an outer loop instead of the innermost one.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Loop over [5, 12, 8, 130, 44] and print the first number greater than 100, then stop.
Print every number from 1 to 10 except multiples of 3, using continue.
Explain it without notes
What is the difference between break and continue?
What does a plain break do inside nested loops, and how do you leave both loops?
Why can't you use break inside forEach?
Console
(nothing was printed)Expected console output
quit seen, total so far: 2
final total: 2
row 3 complete: 123