Using break and continue in Loops in Python


Control loop execution with break and continue.

Source Code

for i in range(10):
    if i == 5:
        continue  # Skip 5
    if i > 7:
        break  # Exit loop
    print(i)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments