How to use pass statements in Python

Source: Internet
Author: User
The Python Pass statement uses when the statement requires that you do not want any commands or code to execute.

The pass statement is an empty (null) operation, and nothing happens at execution time. The pass is also the code that will eventually be useful, but not written out for the time being (for example, in stub cases):
Grammar

The Python Pass statement syntax is as follows:

Pass

Example

#!/usr/bin/pythonfor letter in ' Python ':   if letter = = ' h ':   pass   print ' This is pass block '  print ' current Letter: ', letterprint "good bye!"

When executing the above code, it produces the following result:

Current Letter:pcurrent letter:ycurrent letter:tthis are pass blockcurrent letter:hcurrent letter:ocurrent Letter : Ngood bye!
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.