Break & Continue

Learn how break and continue statements control loops in Python.

Break & Continue

Break Statement

The break statement stops the loop immediately.

for i in range(10):

    if i == 5:
        break

    print(i)
	

Continue Statement

The continue statement skips current iteration.

for i in range(5):

    if i == 2:
        continue

    print(i)
	

Difference Between Break and Continue

  • Break exits loop completely
  • Continue skips only one iteration