DEV Community

Cover image for pass statement in python

pass statement in python

aswin2001barath profile image Aswin Barath ・1 min read

The pass statement does nothing.

Wow, that's a bummer!

Then, why do we need it?

Well, it can be used when a statement is required syntactically but the program requires no action.
Let's see an example:

Alt Text

This is also commonly used for creating empty classes so that we can come back later and code something:
Alt Text

Another place pass statement can be used is inside a function:
Alt Text


  • The body of any statement containing pass statements are ignored by the python interpreter, just like it ignores comments.

Code along and fave fun.

Discussion (0)

Forem Open with the Forem app