trainingtrains Logo

91-9990449935

 0120-4256464

Python Break

break statement is a jump statement that is used to pass the control to the end of the loop.

When break statement is applied the control points to the line following the body of the loop , hence applying break statement makes the loop to terminate and controls goes to next line pointing after loop body.

Keywords

eg:

for i in [1,2,3,4,5]:
    if i==4:
        print "Element found"
        break
    print i,

Output:

>>> 
1 2 3 Element found
>>>

Flow chart of break:

Next TopicPython Continue