Mega Code Archive

 
Categories / Ruby / Hash
 

Printing a Hash

h = {} h[:name] = "Robert" h[:nickname] = "Bob" h[:age] = 43 h[:email_addresses] = {:home => "bob@example.com",                        :work => "robert@example.com"} puts h puts h[:email_addresses] p h[:email_addresses] p h