Comma used to separate keys and values in hash literals until 1.9

I’m reading “Programming Ruby 1.9 & 2.0” and there is a footnote that states:

“As of Ruby 1.9, a comma may no longer be used to separate keys and values in hash literals. A comma still appears between each key/value pair”.

So: how was that before 1.9? How was a comma used before to separate keys and values in hash literals?

I am not sure, but looks like this was the syntax:

> Hash['a', 100, 100, 200, true, false, nil, 'something']
=> {"a"=>100, 100=>200, true=>false, nil=>"something"}

But this syntax works till date…

1 Like