16/16 Iterating over a hash SOLVED

Okay heres the deal…Im having trouble understanding how to do this…Can anyone help me out? Heres my code…Im probably way off… :confused:

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

lunch_order.each { |element| puts element}

Begin by considering how it misbehaves, that may say a lot about which part of the code needs to be adjusted. (Also tells anyone looking to help what they’re looking for)

1 Like

well the error says “It looks like your printing hash keys to the console. Only print the values.” I dont know how to do that…

1 Like

If you’re printing both but only want one, then you’ll need to separate them in some way right? Where does this happen and what have you got to your disposal in that situation?

You’re iterating through a hash using its each method, see if you can make anything out here:
Which I found by googling “ruby hash each”


Okay, thank you…Got it

1 Like

If you scroll down a little there’s also one specifically for getting just the values

1 Like

I am very confused! I still get the same error message even when I try incorperating the new things from the website. Please help!

This exercise really kicking my butt … I checked out that link he provided but it wasn’t speaking to me at all. How did you get the program print out just the values ?

If you have a question or error please create a +New Topic with code, lesson and error/question. Thanks

1 Like