Python break statement - Tutorialspoint1
Python break statement - Tutorialspoint1
It terminates the current loop and resumes execution at the next statement, just like the traditional
break statement in C.
The most common use for break is when some external condition is triggered requiring a hasty exit
from a loop. The break statement can be used in both while and for loops.
If you are using nested loops, the break statement stops the execution of the innermost loop and
start executing the next line of code after the block.
Syntax
break
Flow Diagram
Example
Live Demo
#!/usr/bin/python
https://www.tutorialspoint.com/python/python_break_statement.htm 1/2
1/9/2021 Python break statement - Tutorialspoint
Current Letter : P
Current Letter : y
Current Letter : t
Current variable value : 10
Current variable value : 9
Current variable value : 8
Current variable value : 7
Current variable value : 6
Good bye!
https://www.tutorialspoint.com/python/python_break_statement.htm 2/2