Skip to content

Instantly share code, notes, and snippets.

@beezeebly
Created December 29, 2013 20:45
Show Gist options
  • Save beezeebly/8174642 to your computer and use it in GitHub Desktop.
Save beezeebly/8174642 to your computer and use it in GitHub Desktop.
Ruby: using each with a Hash
book = { "author" => "J.K. Rowling",
"title" => "Harry Potter and the Philosopher's Stone",
"isbn" => "9788478888566"}
book.each {|key, value| puts "#{key} is #{value}"}
# => author is J.K. Rowling
# => title is Harry Potter and the Philosopher's Stone
# => isbn is 9788478888566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment