2. Iterating Over Hashes


#1



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


#2

what did i do wrong?


#3

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


#4

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


#5

Thank you, It worked for me.