2. Iterating Over Hashes

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

Replace this line with your code.

matz = { “First name” => “Yukihiro”,
“Last name” => “Matsumoto”,
“Age” => 47,
“Nationality” => “Japanese”,
“Nickname” => “Matz”
}
matz.each do |key, value|
puts key, matz[key]
end

<do not remove the three backticks above>

what did i do wrong?

The instruction says to print the value not the key. So you have written:

|key,value| these are your parameters. So what should you do:

puts …(value or key which one? you decide. clue: use only one word value or key)
end

1 Like

Here is the code that work for me perfectly.
you trying to print only the values not the key.
hope that help!!

matz = { “First name” => “Yukihiro”,
“Last name” => “Matsumoto”,
“Age” => 47,
“Nationality” => “Japanese”,
“Nickname” => “Matz”
}
matz.each do |key, value|
puts value
end

1 Like

Thank you, It worked for me.