Hashes

Overview

  • A Hash looks like my_hash = {:a_symbol => 3, “a string” => 4}
  • Are referenced like my_hash[:a_symbol] #=> 3
  • like an associative map

Try typing this in IRB

currencies = {‘RWF’ => ‘Rwanda Franc’,
‘USD’ => ‘United States Dollar’}

currencies['RWF'] currencies['USD'] currencies['ABC']

Exercises