KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

What is the implication of the return statement in a function?

Python Functions

1 Like

Answer

The return statement is the statement which sends back the value (result/outcome) from a function to its caller program. It is usually the last statement of the function body and is also referred to as the Function Terminator. The implications of the return statement are as follows:

  1. It signifies an exit of control from the function back to the caller program.
  2. It may or may not pass a value back to the caller function. If used without any value, it simply terminates the function and Python implicitly returns None.
  3. A function can return more than one value using a single return statement (values are returned as a tuple).
  4. Once the control exits from a function through the return statement, it can't get back into the function block for any further execution.

Syntax: return <value>

Answered By

1 Like


Related Questions