DEV Community

Cover image for pass statement in python
Aswin Barath
Aswin Barath

Posted on • Edited on

2 2 1 1 1

pass statement in python

The pass statement does nothing.

Wow, that's a bummer!

Hmmm...
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

Note:

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

Best Resources

Who Am I?

I’m Aswin Barath, a Software Engineering Nerd who loves building Web Applications, now sharing my knowledge through Blogging during the busy time of my freelancing work life. Here’s the link to all of my socials categorized by platforms under one place: https://linktr.ee/AswinBarath

Thank you so much for reading my blog🙂.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay