Skip to main content

Python Pass Statement

It is a Null Statement. A statement which will do nothing. It  is generally used as a placeholder.

Sometimes, pass is used when the user doesn’t want any code to execute. So user simply places pass there as empty code is not allowed in loops, function definitions, class definitions, or in if statements.

def func(args):
    pass
 
class Python:
    pass
 
print(" Executed")

OutputExecuted 

It is generally used to avoid error.

if 1 + 1 == 2:

OutputSyntaxError:invalid syntax 

if 1 + 1 == 2:
    pass

No error, nothing will display.

Tags
Submitted by devanshi.srivastava on June 3, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.