python tutorial - Python Pass - learn python - python programming
What is Python Pass?
- In Python programming, pass is a null statement.
- The difference between a comment and pass statement in Python is that, while the interpreter ignores a comment entirely, pass is not ignored.
- However, nothing happens when pass is executed. It results into no operation (NOP).
- It is used when a statement is required syntactically but you do not want any command or code to execute.
![python pass](https://www.wikitechy.com/tutorials/python/img/python-images/python-pass.gif)
Learn Python - Python tutorial - python pass - Python examples - Python programs
![python pass](https://www.wikitechy.com/tutorials/python/img\python-images\python-pass.png)
- When you do not want any code to execute, pass Statement is used.
- It is same as the name refers to.
- It just makes the control to pass by without executing any code.
- If we want to bypass any code pass statement can be used.
Syntax:
pass
Example:
for i in [1,2,3,4,5,6]:
if i==3:
pass
print "Pass when value is",i
print i,
Explanation:
- When if condition gets true then that executes pass and print the “Pass when value is”.
Output:
>>>
1 2 Pass when value is 3
3 4 5 6
>>>
Wikitechy tutorial site provides you all the learn python , python 3 online course , python scripting training , python training ,
python online course , learning with python , python programming training , learn python programming for beginners , learn python
course , free online courses for python , courses in python