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

Matt Steves
Matt Steves
1,954 Points

This will not work, I need the answer on final challenge, build a contact list

I have tried every possible combination, I just need the answer!

1 Answer

William Li
William Li
Pro Student 26,828 Points

Using the each method, iterate over the contact_list array. Assign each array item to the local variable contact in the block and print out the value of the name and phone_number keys.

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