Skip to content
dreamcode
dreamcode
Back to map
Break & Continue · Lesson 12 of 44
+15 XP on finish
PYTHON BASICS

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.

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.
main.py
PYTHON
real Python, runs in your browser
CONSOLE
- run your code to see output -