The Python pass statement USES examples

  • 2020-04-02 13:32:57
  • OfStack

Python pass is an empty statement. The pass statement does nothing. It is usually used as a placeholder or to create a placeholder program.

The syntax format of the Python pass statement is as follows:

pass

 Example: 


#!/usr/bin/python
for letter in 'Python': 
   if letter == 'h':
      pass
      print 'This is pass block'
   print 'Current Letter :', letter
print "Good bye!"

Execution results of the above examples:

Current Letter : P
Current Letter : y
Current Letter : t
This is pass block
Current Letter : h
Current Letter : o
Current Letter : n
Good bye!


Related articles: