Skip to content
techsnow

Control Flow

Break, Continue and Pass

for n in range(1, 10):
    if n == 3:
        continue   # skip 3
    if n == 6:
        break      # stop the loop at 6
    print(n)

Output

1
2
4
5
KeywordWhat it does
breakExits the loop immediately
continueSkips to the next round
passDoes nothing; a placeholder for code you'll write later