Python pass statement

Python pass statement is null statement. Different between comment and pass is python interpreter ignores comment entirely, pass is not ignored. Nothing happen when pass is executed.

If a loop or a function is not implemented, but has to be implemented in future then it cannot be left empty. The interpreter would generate an error, So we use pass statement to construct body that does nothing.

Example: Python pass statement

for num in range(1,10):
   pass
Was this article helpful?
YesNo

Leave a Comment