7/16 Iterating Over a Hash ok i really need help with this one

This is the code

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

What are you trying to do and what is stopping you?
(Keep in mind that it’s up to you to ask for the information you need)

EDIT: Figured out the answer

lunch_order = {
  "Ryan" => "wonton soup",
  "Eric" => "hamburger",
  "Jimmy" => "sandwich",
  "Sasha" => "salad",
  "Cole" => "taco"
lunch_order.each{ |names, order| 
    puts order

after calling


you then need to reference the names and orders separately so that you are able to only print the order

I’m also having problems with this one. The object of this problem is to iterate over the hashes, but only print out the values of the keys. So the right answer should look like:
wonton soup

I’m not sure how to only print the values.

1 Like