top of page
Writer's pictureRajesh Singh

Pass Statement in Python

Updated: Feb 25, 2021



The pass statement acts as a placeholder and frequently used when there is no need of code but a statement is still essential to make a code syntactically correct. A python comment works similar to the pass statement as it does nothing so we can use comment in place of pass statement. A comment is completely ignored by the Python interpreter whereas pass is not ignored by interpreter, it says the interpreter to do nothing.



Example:

for n in [10, 11, 9, 76, 4, 7, 52]:

if n%2 == 0:

pass

else:

print(n)


Output:

11

9

7



16 views0 comments

Recent Posts

See All

コメント


bottom of page