Mega Code Archive

 
Categories / Ruby / Hash
 

The hash definition is enclosed in curly braces, whereas an array is defined in square brackets

Each value is associated (=>) with a key.  One of the ways you can access the values in a hash is by their keys.  pacific = { "WA" => "Washington", "OR" => "Oregon", "CA" => "California" } pacific["OR"] # => "Oregon"