The
pass statement is like 0 in mathematics. itself has no practical meaning, but it is a character that does exist. So, Python pass statement is an empty statement to maintain the integrity of the program structure. pass does not do anything and is generally used as a placeholder statement, has the same effect as break, but has completely opposite meaning.
The Python language pass statement syntax format is as follows:
pass
Example:
#!/usr/bin/python # -*- coding: UTF-8 -*- # 输出 Python 的每个字母 for letter in 'Python': if letter == 'h': pass print '这是 pass 块' print '当前字母 :', letter print "Good bye!"
The above example execution results:
Current letter: P
Current letter: y
Current letter: t
This is the pass block
Current letter: h
Current letters: o
Current letters: n
Good bye!
These are python Article on the control statement of the loop statement:
The usage and function of the continue statement of the Python statement
Python The break statement in the statement jumps out of the loop instance
The above is the detailed content of What is the function of pass statement in Python statement? A brief discussion on the usage of pass statement. For more information, please follow other related articles on the PHP Chinese website!