pass statement in Python is a keyword which does nothing. It is mostly used with ‘if’ statement or within a loop to represent no operation.
pass keyword is used when we want make our program code look more syntactically sound.
Unlike break & continue, pass does not have any impact on the result of the program.
Let us see one program to see the impact of pass on code.
for i in range(0, 11):
if i % 2 == 0:
pass
print(i)
Above program will print all integers from 0 to 10 EVEN if ‘i’ is an EVEN NUMBER.
However, results would have been different, if either of break or continue had been used in the program instead of pass.
That’s all about pass keyword in Python, see you in the next tutorial.
