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

multiple values return

After long experience in programming today I learned that a method can return multiple values in Ruby. Its awesome.

14th Dec 2016, 12:56 PM
Shekhar Bahuguna
Shekhar Bahuguna - avatar
5 Answers
+ 11
that is why a person who wants to be a good programmer should begin with something like : C, C++, Java, and then : python, ruby and so on. Just to understand the base of logic of the new interactive languages.
25th Feb 2017, 8:33 AM
Ghena Ramascan
Ghena Ramascan - avatar
+ 2
in C and C++, it return only single value.
14th Dec 2016, 2:30 PM
Nawaj Shareef
Nawaj Shareef - avatar
+ 1
Tuples FTW 😜
14th Dec 2016, 1:00 PM
Kerrash
Kerrash - avatar
+ 1
Thank you sir for sharing it. Now I'm soully interested in that ...it's like wow to know returning multiple values. Can you please elaborate more here ?
14th Dec 2016, 1:51 PM
Vipul Walia
Vipul Walia - avatar
+ 1
Multiple return values from function can be done using call by reference method... int func( int a, int&b, int &c) { b=a; c=b*2; return a+1; } int main() { int k,value1,value2; k=func(2,value1,value2); return 0; } here value1 and value2 are changed using references
15th Dec 2016, 6:01 PM
Manikanta Nallamalli (Mittu)
Manikanta Nallamalli (Mittu) - avatar