Project

General

Profile

Actions

Feature #12352

closed

New hash syntax broken for numeric keys

Added by adrianomitre (Adriano Mitre) almost 8 years ago. Updated over 2 years ago.

Status:
Rejected
Target version:
-
[ruby-core:75375]

Description

[Matz himself showed in RubyConf 2015 the following example]:

h = { 1: 2, 2: 4, 3: 6 }

Which gives

SyntaxError: unexpected ':', expecting =>
h = { 1: 2, 2: 4, 3: 6 }
        ^

but which should give identical results to

>> h = { 1 => 2, 2 => 4, 3 => 6 }
=> {1=>2, 2=>4, 3=>6}
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0