From: James Britt Date: 2005-05-20T23:38:02+09:00 Subject: Re: Multiple return and parallel assignement James Edward Gray II wrote: > On May 20, 2005, at 8:05 AM, jean wrote: > >> What do you think about? (Perhaps I don't know enough Ruby and there is >> a way to do the same thing in Ruby ;-) ) >> >> Thinking at Ruby I'd like that if I call mymethod defined above with >> only a variable it gets the first value: > > > Probably not what you want, but: > > irb(main):001:0> def mymethod > irb(main):002:1> return 1, 2 > irb(main):003:1> end > => nil > irb(main):004:0> one = mymethod.first > => 1 > > Hope that helps. I think this helps point out that mymethod is not returning multiple values, but a single value (an Array object) that contains multiple values. James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.org http://orbjson.rubyforge.org http://ooo4r.rubyforge.org http://www.jamesbritt.com