Python pass statement

The pass statement does not do anything. It is used with 'if' statement or inside a loop to represent no operation. We use pass statement when we need a statement syntactically but we do not want to do any operation.

The syntax of pass statement is given below:

CopiedCopy Code

looping structure
{
  if(particular itraticve value)
  {
     pass:   
  }
}

pass statement example:

Sample program:A program to know that pass does nothing

CopiedCopy Code

x = 0
while x<10: 
   x+=1 
   if x>5: 
      pass 
   print ('x=', x) 
print("Out of loop")