0
What does it mean by ' return' in cooding?and why it is use??
2 Answers
+ 1
I want you to take a close look at this code for a minute.
def square(x):
return x * x
n = square(4)
print(n)
After I declared the "square" function, I had the result of square(4) stored in n, so n = 16.
0
return tells a function to stop execution and give the value it evaluated back to the caller, killing the function in the process.