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:
This is also commonly used for creating empty classes so that we can come back later and code something:
Another place pass
statement can be used is inside a function:
Note:
- The body of any statement containing
pass
statements are ignored by the Python interpreter, just like it ignores comments.
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 craziness categorized by platforms under one place: https://linktr.ee/AswinBarath
Join me to learn Python!
Checkout my Python Programming Series where my mission is to share my knowledge on Python: aswinbarath.hashnode.dev/series/python-prog..
Learn what I know about Python from any of my favourite knowledge sources:
Keep Learning
Now, I guess this is where I say GoodBye👋.
But, hey it’s time for you to start learning with your newfound Knowledge(Power)👨💻👩💻 .
Good Job that you made it this far 👏👏
Thank you so much for reading my Blog🙂.