Home »
Python
Python break and continue Statements
Last Updated : April 21, 2025
In Python, the break and continue are the keywords in Python, they are used for the different purposes inside the loop statements with the conditional statements. The break statement terminates the execution of the loop (if the given condition is true) whereas the continue statement skips the current execution of the loop (if the given condition is true) and jumps the execution to the next iteration.
1. Python break statement
The break can be used to unconditionally jump out of the loop. It terminates the execution of the loop. The break can be used in while loop and for loop. It is mostly required, when because of some external condition, we need to exit from a loop.
Example
for letter in "Python":
if letter =='h':
break
print (letter)
Output
P
y
t
2. Python continue statement
The continue statement is used to tell Python to skip the rest of the statements of the current loop block and to move to next iteration, of the loop. The continue will return back the control to the beginning of the loop. This can also be used with both while and for statements.
Example
for letter in "Python":
if letter == 'h':
continue
print(letter)
Output
P
y
t
o
n
Python break and continue Statements Exercise
Select the correct option to complete each statement about the break and continue statements in Python.
- The ___ statement is used to terminate the current loop and resume execution at the next statement after the loop.
- The ___ statement is used to skip the current iteration of a loop and continue with the next iteration.
- If the break statement is used in a loop, it will ___ the loop immediately.
Advertisement
Advertisement