Iterating over Hashes

PHOTO EMBED

Sun May 30 2021 15:28:01 GMT+0000 (UTC)

Saved by @decosta1228

secret_identities = {
  "The Batman" => "Bruce Wayne",
  "Superman" => "Clark Kent",
  "Wonder Woman" => "Diana Prince",
  "Freakazoid" => "Dexter Douglas"
}
  
secret_identities.each do |superheroName, realIdentity|
  puts "#{superheroName}: #{realIdentity}"
end




# Prints out just the values

lunch_order = {
  "Ryan" => "wonton soup",
  "Eric" => "hamburger",
  "Jimmy" => "sandwich",
  "Sasha" => "salad",
  "Cole" => "taco"
}



lunch_order.each do |name, food|
  puts "#{food}"
end
content_copyCOPY