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.
Written by adone
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#