Python Tutorial

Python break Statement With Examples

What is Python Break Statement?

When a situation outside of the system is triggered, the break statement in Python is used to pull the control out of the loop. Inside the loop, the body is a break statement (generally after if condition).

Syntax:

break

Example:

i = 1

while i < 7:

  print(i)

  if (i == 4):

    break

  i += 1

Output:

1
2
3
4
Did you find this article helpful?