From: Matthew Moss Date: 2008-12-12T13:50:52+09:00 Subject: Re: parallel method return value > and with a method: > >>> def a_method >>> return 1, 2, 3 >>> end > => nil >>> a,b = a_method > => [1, 2, 3] >>> a > => 1 >>> b > => 2 > > If I want only one lvalue, is this: >>> a, = 1, 2, 3 > => [1, 2, 3] >>> a > => 1 > the only way to get it? > > I would have liked for the return behaviour to be set on the right > side, > to allow method invocation like: >>> puts a_method > > to return: > 1 > > instead of > 1 > 2 > 3 So... uh, why wouldn't you just return one value? That is: def a_method return 1 end ??? Perhaps, if it's an array you have, then just use method #first: def a_method return some_array.first end