0
Can someone explain this 'return' in clear words.
Can someone explain this 'return' in clear words. I don't seem to get it
2 Answers
+ 3
You can use the sololearn app and go to the "learn" section. Use the search bar with "return". You will find explanations / lessons about "return" for the most languages.
0
For example
#usr/bin/python
def plus():
return 2*2
plus() #this does not do anything it produces the value '2*2 = 4' then destroys it because return cannot save the value of 2*2 anywhere
X = plus() #plus() saves the value '2*2 = 4' in X so X is now 4
so 'return' returns a value( '2*2 = 4' )and assigns it to a variable ('X')