From: Matthew Moss Date: 2008-12-13T07:08:06+09:00 Subject: Re: parallel method return value >> a, = foo >> a = foo[0] >> a = foo.first >> >> All three of those do the same... assign 1 to a. The latter two >> request specifically the first item, while the first does parallel >> assignment (of array components to particular variables... in this >> case, only a). Since you seem interested in parallel assignment to >> a variable number of variables, the first seems appropriate. >> Granted, forgetting the comma might be easy, but there's no way for >> foo to know that you want a = foo to return 1 and that someone else >> that does a = foo wants [1, 2, 3]. > > you can use the masign commas to get sort of what you want: > > irb(main):001:0> def foo > irb(main):002:1> return 1,2,3 > irb(main):003:1> end > => nil > irb(main):004:0> a, = foo > => [1, 2, 3] > irb(main):005:0> a > => 1 You mean like my first example above? :D