PYTHON BASICSChapter 3 · Loops and iteration
Escaping loops
Use break to exit a loop immediately. Use continue to skip the rest of the current turn and jump straight to the next one.
Worked example
How it reads
- continue skips printing 2 and jumps to the next turn
- break exits the loop before printing 4

Cloud tip: break and continue work in both for loops and while loops.


