Here you will learn about break statement in python with its example.
The break statement in python is used to exit a loop.
Here is an example shows how break statement is useful to exit from a loop.
# Python break Statement Example print("Welcome to Python break statement."); count = 0; while True: count += 1; if count>10: break; print(count);
Here is the sample output of the above break statement example code in python.
As you can see from the above output, when the variable count holds the value 11 then the condition count>10 or 11>10 evaluates to be true, and the break statement run to exit from the loop.