This page topics close

The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action.

In Python, pass keyword is used to execute nothing; it means, when we don't want to execute code, the pass can be used to execute empty. It is same as the name refers to. It just makes the control to pass by without executing any code. If we want to bypass any code pass statement can be used.


Example of pass
drag_handle
for i in [1, 2, 3, 4, 5]:
    if i == 3:
        pass
        print("Pass when value is", i)
    print(i)

Output:

1
2
Pass when value is 3
3
4
5

What next?

The next topic is Python Functions

Share this page