Ruby Build an Address Book in Ruby Search Appending Contacts

Mark Weinberg
Mark Weinberg
3,002 Points

Initialize a variable called address_book set to a new instance of the AddressBook class.

I am having trouble with Challenge Task 1 of 2 which is Initialize a variable called address_book set to a new instance of the AddressBook class. I put in my code down below but I'm not sure what is wrong. Can someone show me the correct code to this challenge?

address_book.rb
contact = Contact.new
contact.first_name = "My"
contact.last_name = "Name"

class AddressBook

  def initialize
    address_book
  end



end

3 Answers

Kevin Korte
Kevin Korte
28,066 Points

The class AddressBook has already been created, so all it wants you to do is to create a new variable called address_book and make it equal a Addressbook.new.

Much like the very first line they have you with the contact example.

Margeaux Spring
Margeaux Spring
34,703 Points

Also, you cannot add "end" or it won't pass

Sean Flanagan
Sean Flanagan
33,218 Points

Hi Mark. I agree with both Kevin and Margeaux (thank you both). I tried creating an AddressBook class myself and it wouldn't pass. Since this class already exists, you just need to create a new instance of the class. Good luck. :)