Last Updated: February 25, 2016
·
325
· adone

ruby array assignment

The assignments of values ​​separated by commas leads to interesting results:

a = 1, b = 2, c = 3

and we got [1, 2, 3] in a, 2 in b and 3 in c.

It works because ruby parser did not see difference between a = 1, 2, 3 and a = [1, 2, 3].

May be it will useful for somebody.