What you need to know that your case only works fine, because the numbers are immutable in Ruby. You don't want to do this with strings, arrays, hashes, or just about anything other than numbers, because it would create multiple references to the same object, which is almost certainly not what you want:
a = b = c = d = "test" b << "x" => "testx" a => "testx"
While parallel form is safe for all types:
a,b,c,d = "test","test","test","test" => ["test", "test", "test", "test"] b << "x" => "testx" a => "test"
glenn mcdonald May 28 '10 at 2:09 pm 2010-05-28 14:09
source share