Understanding of return

Can I understand return as a saving the value and send it back? If I wasn’t quite right, can anyone explain what it does? Thank you.

Pretty much, yes. return gives data (a value) to the caller (the part of the program that calls the function). So in this case, the variable x is a caller:

x = someFuncWithReturn()

I hope this helps!

Perfectly explained. Thank you!

1 Like