Ruby Build an Address Book in Ruby Input and Output Instance Variable Access

Miles Smith
Miles Smith
2,688 Points

Correct the code below to make the contacts variable an instance variable.

Hey guys i get the error saying the "@" symbol turns my code into an instance variable, but isn't that whats being asked of me to find?

address_book.rb
class AddressBook
  attr_reader :contacts

  def initialize
    @contacts
  end
end

1 Answer

Hi Miles,

I think you may have just inadvertently deleted the variable assignment:

class AddressBook
  attr_reader :contacts

  def initialize
    @contacts =[]
  end
end

Best, Cena