Variables
Hashes in Ruby
Used to store values using a dictionary (key value pair) system.
Syntax
hash_table = { 'hash_key' => value }
#add new hash key
hash_table['hash_key2'] = value2
#retrieving a value from a key
hash_table['hash_key']
#using a symbol as a key
hash_table = { symbol: value }
Notes
Hash tables are mixed type, similar to arrays.
Example
days_of_week = {'Monday' => 'mon', tuesday: 'tues'}
days_of_week['Wednesday'] = 'wed'
>> days_of_week['Monday']
=> 'mon'
>> days_of_week[:tuesday]
=> 'tues'