Printing a Hash : Print Hash « Hash « Ruby
- Ruby
- Hash
- Print Hash
Printing a Hash
h = {}
h[:name] = "Robert"
h[:nickname] = "Bob"
h[:age] = 43
h[:email_addresses] = {:home => "[email protected]",
:work => "[email protected]"}
puts h
puts h[:email_addresses]
p h[:email_addresses]
p h
Related examples in the same category