Python Pass Statement


Contents

It is adopted when a statement is needed syntactically yet users do not require any command or code to perform.

The bypass statement is an unacceptable operation; zero happens when it performs. The pass is also practical in positions where your policy will finally go, but has not been written yet (e.g., in stubs for example):

Syntax

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!"

When the above code is executed, it produces following result:

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

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.



Navigation
Tutorial
Tutorial
Tutorial