Home >>Python Keywords >Python break Keyword
Python break keyword is used to break out of a for loop or a while loop. Using this keyword, we get out of the loop as soon as the break condition satisfies without finishing the loop iteration.
Here is an example of Python break keyword:
for i in range(9):
if i > 5:
break
print(i)
i = 1
while i < 9:
print(i)
if i == 7:
break
i += 1