What does the pass statement do in a python statement? On the usage of pass statement

Source: Internet
Author: User
The pass statement is like 0 in mathematics, does not have any practical meaning, but it is a character that does exist. So, Python Pass Statementis an empty statement, in order to maintain the integrity of the program structure, PassDon't do anything, general Used as a placeholder statementThe effect is the same as break, the meaning is completely opposite.

The Python language Pass statement has the following syntax format:

Pass

Instance:

#!/usr/bin/python#-*-coding:utf-8-*-# Output Python for letters in ' Python ': "if letter   = = ' h ':         pass          Print ' This is the pass block '     print ' current letters: ', letter      print ' good bye! '

The result of the above instance execution:

Current Letter: P
Current Letter: Y
Current Letter: T
This is a pass block.
Current Letter: H
Current Letter: O
Current Letter: N
Good bye!


These are the control statements for the Python Loop statement article:

The usage and function of the continue statement of the Python statement

Break statement in Python statement jumps out of Loop instance


Related Article

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.