Python break Statement

« Previous Tutorial Next Tutorial »

Here you will learn about break statement in python with its example.

The break statement in python is used to exit a loop.

Python break Statement Example

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:

Here is the sample output of the above break statement example code in python.

python break statement

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.

« Previous Tutorial Next Tutorial »


Quick Links
Signup - Login - Give Online Test