Return in python


#1

Hello,

what exactly does “return” do in a function? I kind of get what it does but not exactly. Sorry for the noob question; I just started coding


#2

From StackOverflow:

The print() function writes, i.e., “prints”, a string in the console. The return statement causes your function to exit and hand back a 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.


#3

Thank you! :grinning: