+ 4
multiple values return
After long experience in programming today I learned that a method can return multiple values in Ruby. Its awesome.
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.
+ 2
in C and C++, it return only single value.
+ 1
Tuples FTW đ
+ 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 ?
+ 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