Python break statement

The break statement, like in C, breaks out of the innermost enclosing for or while loop.


Example of using break


# Example of break statement
for i in range(7):
	print("value of i "+str(i))
	if i==5:
		print("Going to apply break")
		break

	 
value of i 0
value of i 1
value of i 2
value of i 3
value of i 4
value of i 5
Going to apply break