break is used to exit a for loop or a while loop, whereas continue is used to skip the current function, and return to the "for" or "while"statement.
e.g:
count = 0
while True:
print(count)
count += 3
if count >= 7:
break
- continue
for x in range(1,20,4):
# Check if x is even
if x % 2 == 0:
continue
print(x)
Top comments (0)