Return vs Print


So I successfully made it through the functions tutorial, hooray! However I'm still having a but of trouble understanding the purpose of return. For example, in:

I know that print will throw up '10 squared is 100' for the user to see, and I think that return does something with the variable squared that could be used later but isn't for the user to see? What is the exact purpose of return squared in this instance? And if its to be used later, could I get an example of how that may be?


Well you can see the value of return if you type print function-name, for example:

print square(10), will print:

10 squared is 100

But that's another issue :smiley:

As far as I know, is return some kind of storing, you can think of it like storing an integer in the function, instead of a variable.

So your function square has stored the value 100.