In Python, the ignore key-word is used to execute nothing; it means, when we do not prefer to execute code, the ignore can be used to execute empty. It is the same as the identify refers to. It simply makes the manipulate to skip with the aid of besides executing any code. If we want to ignore any code bypass declaration can be used.
It is really useful when a declaration is required syntactically, but we desire we don’t prefer to execute or execute it later. The difference between the remarks and pass is that, remarks are totally ignored by using the Python interpreter, where the bypass announcement is no longer ignored.
Suppose we have a loop, and we do not prefer to execute proper this moment, however we will execute in the future. Here we can use the pass.
Consider the following example.
Example – Pass statement
# pass is just a placeholder for
# we will adde functionality later.
values = {'P', 'y', 't', 'h','o','n'}
for val in values:
pass
Example – 2:
for i in [1,2,3,4,5]:
if(i==4):
pass
print("This is pass block",i)
print(i)
Output:
1
2
3
This is pass block 4
4
5
We can create empty type or function the use of the pass by statement.
# Empty Function
def function_name(args):
pass
#Empty Class
class Python:
pass
Leave a Review