What is the purpose of a return statement in a function?
A return statement in a function looks like this. def test(func, arg): return func(func(arg)) def mult(x) return x * x print(test(mult, 2)) Okay so according to the Python course this is higher order function. Which basically takes other functions as arguments, or return them as results. Which I can understand. However, what is the purpose of the return statement? Now if I comment that out and use pass (Just to see how the code will react) i get None. def test(func, arg): pass #return func(func(arg)) def mult(x) return x * x print(test(mult, 2)) Output>>> None So, is the return statement doing something on the backend, unseen? Now, I read online that return statement returns when function is called. So, is the print function calling the function or the return?