Mega Code Archive

 
Categories / Ruby / Hash
 

A hash ( associative array or a dictionary) is an array holding a collection of data

# you can index it using text strings as well as numbers. # To create a hash, you use curly braces, { and }, not square braces ([]) as with arrays.  money = {"Dan" => "$1,000,000", "Mike" => "$500,000"} # "Dan" is a hash key  # "$1,000,000" is the value.  # The => operator separates the keys from the values.