How do I use void in Python?

1 answer

Answer

1196316

2026-04-12 18:15

+ Follow

In Python, void is not a specific keyWord or type like in some other programming languages. Instead, when you want to define a function that does not return a value, you simply define it without a return statement or use return without a value. Such a function is often referred to as returning None by default. For example:

<code class="language-python">def my_function():

print("This function does not return anything.")

</code>

Here, my_function() executes its code but does not return a value.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.