return | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

return

void:does't return any value what does it mean : return? please!,explain me.

10th Jul 2018, 5:54 PM
Yimer Indris
Yimer Indris - avatar
2 Answers
+ 3
re·turn verb 1. come or go back to a place or person. "he returned to Canada in the fall" synonyms: go back, come back, come home "he returned to Halifax" 2. give, put, or send (something) back to a place or person. "complete the application form and return it to this address" synonyms: give back, hand back; noun 1. an act of coming or going back to a place or activity. "he celebrated his safe return from the war" synonyms: homecoming "his return to Oregon" 2. a profit from an investment. "product areas are being developed to produce maximum returns" synonyms: yield, profit, gain, revenue, interest, dividend "a quick return on investments" ^That's the definition of the word return. In this context, it's the act of returning data from the called method/function back to the method/function that called it. So lets say I created a method called public int GetSum(int a, int b).... Somewhere else in my code I would call that methood with GetSum(2,2); and then from the method GetSum() it would do its calculations to add the number and RETURN the result (or w/e) back to the code where I called GetSum() at. This is very useful when you want to return data back from a function so that you can use its results elsewhere.
10th Jul 2018, 6:10 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
To return means to give back. A void function for example does not return a value which means it cannot be assigned to a variable.
10th Jul 2018, 10:44 PM
Blade Wolfmoon
Blade Wolfmoon - avatar