Non-Value-Returning Functions

 Non-value-returning functions are used not for their return value, but for their side effects. A side effect is an action performed by the function other than returning a value. For instance, displaying output on the screen.

Difference in Function Call:

  • A call to a value-returning function is an expression, as for the call to function avg: result = avg(10, 25, 16) * factor.
  • When non-value-returning functions are called, however, the function call is a statement
  • In this example, function displayWelcome() is called only for the side-effect of the screen output produced.
  • In Python, all functions technically return a value, which is None by default if no explicit return value is specified.
  • Functions that don't explicitly return a value are typically categorized as non-value-returning functions.