![Pass Arguments Python](https://www.wikitechy.com/tutorials/python/img/python-images/pass-arguments-python.gif)
Learn Python - Python tutorial - Pass Arguments Python - Python examples - Python programs
In C/C++ and Java, we can write empty function as following
![python functions](https://www.wikitechy.com/tutorials/python/img/python-images/python-functions.png)
python - Sample - python code :
// An empty function in C/C++/Java void fun() { }
In Python, if we write something like following in Python, it would produce compiler error.
![python return function](https://www.wikitechy.com/tutorials/python/img/python-images/python-return-function.png)
python - Sample - python code :
# Incorrect empty function in Python
def fun():
python tutorial - Output :
IndentationError: expected an indented block
In Python, to write empty functions, we use pass statement. pass is a special statement in Python that does nothing. It only works as a dummy statement.
![return functions](https://www.wikitechy.com/tutorials/python/img/python-images/return-functions.png)
python - Sample - python code :
# Correct way of writing empty function
# in Python
def fun():
pass
We can use pass in empty while statement also.
![Variables and initialize](https://www.wikitechy.com/tutorials/python/img/python-images/variables-and-initialize.png)
python - Sample - python code :
# Empty loop in Python
mutex = True
while (mutex == True) :
pass
We can use pass in empty if else statements.
![many functions consume](https://www.wikitechy.com/tutorials/python/img/python-images/many-functions-consume.png)
python - Sample - python code :
# Empty in if/else in Python
mutex = True
if (mutex == True) :
pass
else :
print("False")