Skip to content

Instantly share code, notes, and snippets.

@rivsc
Created June 14, 2017 13:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rivsc/7bf65763647beabc0ed83742bf8f0876 to your computer and use it in GitHub Desktop.
Hash syntaxe
# Clé integer
2.3.3 :054 > { 4 => 'truc' }
=> {4=>"truc"}
2.3.3 :055 > { 4: 'truc' }
SyntaxError: (irb):55: syntax error
# Clé string
2.3.3 :061 > { 'cle': 'truc' }['cle']
=> nil
2.3.3 :062 > { 'cle' => 'truc' }['cle']
=> "truc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment