Ruby Ruby Loops Build a Simple Contact List Hash and Array Iteration

Why isn't this printing out the values?

Not printing out the values for both keys

contact_list = [
  {"name" => "Jason", "phone_number" => "123"},
  {"name" => "Nick", "phone_number" => "456"}

contact_list.each{ |name, phone_number|
  contact = "#{name}, #{phone_number}"

puts contact

1 Answer

Romain Gaget
Romain Gaget
24,449 Points

Hi, you close:

contact_list.each do |contact|
  puts contact["name"]
  puts contact["phone_number"]