Placeholder statement pass in python

The pass statement is a placeholder statement in python, also known as an empty statement. When the program runs to the pass statement, it does not do anything and runs the following statement directly.

The pass statement serves as a placeholder for space in order to maintain the integrity of the program structure.

#!/usr/bin/env python
# -*- coding:utf-8 -*-


if __name__ == '__main__':
    for i in range(0, 5):
        if i == 2:
            pass
        else:
            print(i)

output:

0
1
3
4

Guess you like

Origin blog.csdn.net/kevinjin2011/article/details/129418940