Python - Jumping Statement

Jumping statements are the statements that stop the execution of the loop in between or skip out from the iteration.

3 types of jumping statements are:

  1. break
  2. continue
  3. pass

Python - Break

Python break is used to break the execution of a loop.

for i in range(1,11):
    if i==5:
        break
    print(i)

Python - Continue

Python continue statement is used to skip the statements.

for i in range(1,11):
    if i==5:
        continue
    print(i)

Python - Pass

Python pass statement is used to do nothing, when you want to pass statement.

for i in range(1,11):
    if i==5:
        pass
    else:
        print(i)