I need help on this whole course


#1

I tried everything I learned from there but I couldn't. SO can someone please help me with this code.

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


#2

What's the error you're receiving? :smile:


#3

Oops, try again. It looks like you didn't print anything to the console.


#4

Well, you didn't print anything :smile:
What are the instructions?


#5
  1. Iterate through .each key/value pair in lunch_order.

  2. Please puts out the value of each pair (just the value, not the key).


#6

Jacobs are you here.


#7

Okay, so given those instructions how can you go through each item and print the value?

You have, at this point, probably been taught how to use loops, right?


#8

Yes I did. I know how to use loops


#9

OK, so what it wants you to do is loop through lunch_order and print out everyone's order.

For example, the output should look like:

wonton soup
hamburger
...


#10

what should I do? there are tons of loops.


#11

There are no loops in the code you gave.

However, the instructions suggest you to use a foreach loop (.each).


#12

Just read through the tutorial and you will get it.


#13

Do you still need help on Date Structures 16 ?


#14

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

lunch_order.each { |x,y| puts y }