"David A. Black" <dblack / wobblini.net> schrieb im Newsbeitrag news:Pine.LNX.4.44.0312190524460.4320-100000 / wobblini... > Hi -- > > On Fri, 19 Dec 2003, Robert Klemme wrote: > > > > > "David A. Black" <dblack / wobblini.net> schrieb im Newsbeitrag > > news:Pine.LNX.4.44.0312181612570.29763-100000 / wobblini... > > > irb(main):001:0> def two; return 1,2; end > > > => nil > > > irb(main):002:0> a,b = two > > > => [1, 2] > > > irb(main):003:0> a > > > => 1 > > > irb(main):004:0> b > > > => 2 > > > > > > That might be the best way if you don't need to deal with the two > > > values as a pair beyond getting them back from the method. > > > > Even if you need to deal with them as pair this is the appropriate method: > > Do you mean: even if you don't need to deal... ? > > > irb(main):001:0> def two; return 1,2; end > > => nil > > irb(main):002:0> all = two > > => [1, 2] > > irb(main):003:0> > > I'm not sure what you mean by appropriate. Can you elaborate? Sorry for the delay. I meant "return a,b" is the appropriate idiom for accessing single values as well as for accessing all values in an array. Of course you can do "return [a,b]" as well. So with the definition above you can do "x,y = two()" as well as "z = two()" where z is an array. Regards robert