Return statement
We will create functions that return values.
The return statement causes your function to exit and hand back value to its caller. The point of functions, in general, is to take in inputs and return something. The return statement is used when a function is ready to return a value to its caller.
As a result, it is best to use the default value of
None
as a flag to signify the absence of the argument and handle the case inside the function body.We will do it in another way, but we will get the same results
But if we don't use the return statement,
we got the "None" , that represent the Absence of a value
Two things to remember:
- By default, all functions in python return the value of "None" in you don't have the "return" value
- If you have a function to calculate something, you can calculate the result using the Result statement
Return statement
Reviewed by ohhhvictor
on
May 09, 2019
Rating:
No comments: