From: Ross Bamford Date: 2006-02-22T20:27:32+09:00 Subject: Re: Syntax questions On Wed, 2006-02-22 at 10:50 +0900, David Vallner wrote: > david@chello082119107152:~$ irb > irb(main):001:0> a, b = [1, 2] > => [1, 2] > irb(main):002:0> a > => 1 > irb(main):003:0> b > => 2 > > Might possibly change in 1.9 / 2.0 to reduce the ambiguity and general mystery > surrounding parallel assignment in strange cases. (Basically, once the number > of lvalues and rvalues differs, things get mildly funky, and it's only > downhill from there) Seriously? If that's true, I hope it never comes to pass. I don't think it's mysterious, and it's saved me a good few lines of code here and there... a,b = [1,2,3] # => [1, 2, 3] a # => 1 b # => 2 a,*b = [1,2,3] # => [1, 2, 3] a # => 1 b # => [2, 3] a,b,c = [1,2] # => [1, 2] a # => 1 b # => 2 c # => nil Which is exactly what I expected to happen. -- Ross Bamford - rosco@roscopeco.REMOVE.co.uk