Pass statement

Pass Statement


pass statement in Python programming is a null statement. pass statement when executed by the interpreter it is completely ignored. Nothing happens when pass is executed, it results in no operation.

pass statement can be used in ‘if’ clause as well as within loop construct, when you do not want any statements or commands within that block to be executed.

Syntax:

pass

Example : Program to illustrate the use of pass statement

a=int (input(“Enter any number :”))
if (a==0):
pass
else:
print (“non zero value is accepted”)

Output:

Enter any number :3

non zero value is accepted


Example : Program to illustrate the use of pass statement in for loop

for val in “Computer”:
pass
print (“End of the loop, loop structure will be built in future”)

Output:

End of the loop, loop structure will be built in future.

Python : Pass statement Program List