Can someone explain this 'return' in clear words. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain this 'return' in clear words.

Can someone explain this 'return' in clear words. I don't seem to get it

16th Apr 2020, 1:07 PM
Akinwale David
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.
16th Apr 2020, 2:55 PM
Lothar
Lothar - avatar
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')
16th Apr 2020, 1:21 PM
William M
William M - avatar