Return Statement

Return Statement

  • Function can take input values as parameters and executes business logic, and returns output to the caller with return statement. 

  • We can return the result or output from the function using a return statement in the body of the function.

Example:

  • Q. Write a function to accept 2 numbers as input and return sum.

Note: If we are not writing return statement then default return value is None.

 

Comments