Python Break Statement

You can use the Python break statement to jump out of a Python looping code. Example is when using the for loop as shown below.

#Python break statement
for i in range(2, 11):
  if i == 7:
    break
  print(i)


------------------------------------------------
#Ouput
2
3
4
5
6

Comments

Popular posts from this blog

How to write to a file in Kotlin

Python Tkinter example