Question: Why do we need a return statement after all?
My ambiguity:
I'm asking this because we can use the print()
function instead of the return
statement and call our function without printing it. If we do this, we don't get a None
return value either, so why do we use a return statement at all?
More explanation: I know if we don't use the "return statement" and print our function when we call it, we get a None
return value, but that's useless to me, as I'm not sure why we do that. I've experimented that we don't need to "print" our function when we call it to get the "return value", instead, we can simply replace the return
statement with print()
and then call our function, without printing it. With this approach, we don't get the None
return value either.
This what I'm trying to convey:
def multiplication(x, y): # A function without a return statement.
multiply = x * y
print(multiply) # Instead of using return statement, I used print() function.
multiplication(2, 2) # Instead of printing the function, as if I'd have done that, I would've gotten 'None' as return value at the end; instead, I simply called the function.