Create An Array In Ruby Without Square Brackets

June 23, 2018

Today I learned – you can create an array without []:

irb> a = [1, 2, 3]
=> [1, 2, 3]
irb> b = 1, 2, 3
=> [1, 2, 3]
irb> a == b
=> true

This seems so simple that I wonder if I learned about this a long time ago and forgot?


Enjoy!