close

How to exit the if Statement in Python

Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about how to exit the if Statement in Python. so without wasting time lets learn about of this.

How to exit the if Statement in Python

  1. exit the if Statement in Python

    to exit the if Statement in Python just use break. By using break you can exit the if statement from python. So without wasting time lets learn about of this by given below example: for i in range(15): print(i) if i == 4: break Output : 0 1 2 3 4

  2. How to exit the if Statement in Python

    to exit the if Statement in Python just use break. By using break you can exit the if statement from python. So without wasting time lets learn about of this by given below example: for i in range(15): print(i) if i == 4: break Output : 0 1 2 3 4

  3. python exit if statement

    to exit the if Statement in Python just use break. By using break you can exit the if statement from python. So without wasting time lets learn about of this by given below example: for i in range(15): print(i) if i == 4: break Output : 0 1 2 3 4

Method 1: Using break

By using break you can exit the if statement. So without wasting time lets learn about of this by given below example:

for i in range(15):
    print(i)
    if i == 4:
        break

Output :

0
1
2
3
4

Conclusion

It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?

Also, Read

Leave a Comment