2/15 Iterating Over Hashes


#1



https://www.codecademy.com/courses/ruby-beginner-en-Qn7Qw/0/2?curriculum_id=5059f8619189a5000201fbcb#


I don't know what's wrong. I followed the instructions exactly. The hint tells me exactly what to put for the "puts" statement, but I still get it wrong. I get this error message: "Oops, try again. It looks like you didn't print Yukihiro using puts."
Please help me understand this lesson,.


matz = { "First name" => "Yukihiro",
  "Last name" => "Matsumoto",
  "Age" => 47,
  "Nationality" => "Japanese",
  "Nickname" => "Matz"
}

matz.each do |key|
    
    puts matz[key]
    
end


#2

For your block parameters provide a placeholder for both key and value.

matz.each do |key, value|
    puts "#{key} => #{value}"
end

or the way you have it, just with two parameters.

puts matz[key]