For what purpose we are using return statement?? Help me to understand clearly and easily | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For what purpose we are using return statement?? Help me to understand clearly and easily

2nd Jul 2016, 6:46 AM
Mariyadinesh
3 Answers
+ 2
forexample you want a multiple method. public int multipl(int i, int y){ int M = x * y; return M; } this is really simple i think.
2nd Jul 2016, 10:22 AM
Máté Lencsés
Máté Lencsés - avatar
+ 1
Return returns something. Void returns nothing. int test(int x, int y) { return x + y; }
2nd Jul 2016, 10:59 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
0
so you can use it like: class Dog{ var Age = multipl(2,3) } Output: Age = 6
2nd Jul 2016, 10:30 AM
Máté Lencsés
Máté Lencsés - avatar