pass Statement

The pass statement in python acts as a placeholder and used where a statement is syntactically required but we don’t want to execute any statement there.

For example, when we want to declare a function but don’t want to provide its implementation. In this case, we can’t leave the body of our function empty as this would raise error because of its incorrect syntax. In such cases, we can use the pass statement which does nothing but makes our code syntactically correct.



Example: A function that does nothing.

    def myFunction():

Example: A class with no methods.

    class myClass: