In python, we can write an empty function or statements by using the ‘pass” statement. Writing a pass statement does nothing and is simply used to avoid compile errors while writing an empty function.
Empty function in python: #Empty function in Python def empty_func(): pass
Above code statements are little different than other popular programming languages like C,C++ or Java.
#An empty function in C/C++/Java void func() { }
Empty loop in Python
We can write an empty loop, using “pass” statement -
#Empty loop in Python condition = True while (condition == True): pass
Similarly we can empty conditional statement (if/else) using “pass” statement -
condition = True if(condition == True): pass else: print("Error")