DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Ruby Hashes Example

08.10.2011
| 3865 views |
  • submit to reddit
        This piece of code demonstrate <a href="http://programmingbulls.com/ruby-hash">ruby hash</a> iterating:

#!/usr/bin/ruby
 
address = {
	"First name" => "First",
	"Last name"  => "Last",
}

address.each do |key, value| 
	puts key + " - " + value 
end