Python: pass Loop Control Statement

The flow inside looping statements are controlled using the looping control statements like pass, break and continue.

In python, pass is a null statement which is used to do create empty blocks. When pass is executed, it results in no operation and the control will move to the next statement applicable.

Example

Below example program shows how pass can be used to create a empty if block.

num=10
count=0
while(count <= num):
   if(count%2 == 0):
	  pass
   else:
	  print(count)
   count+=1

Output

1
3
5
7
9

In the above example try to explain the case of pass statement and treat as empty block. Otherwise same case be handle through continue with same result.