Welcome! In this lesson, we’ll explore creating a simple address book application using Ruby hashes. This exercise will strengthen your understanding of hashes in Ruby, specifically in adding, retrieving, and deleting entries.
By the end of this lesson, you’ll have a solid grasp of these fundamental operations and how they’re applied in practical programming tasks.
In this task, we’ll build three core methods to manage our address book:
- add_contact(name, phone_number): Adds a new contact. If the contact already exists, it returns- falseand does not overwrite the number; otherwise, it adds the contact and returns- true.
- get_contact(name): Retrieves the phone number for a given- name. If the contact does not exist, it returns- nil.
- delete_contact(name): Deletes a contact with the specified- name. Returns- trueif the contact was successfully deleted and- falseif the contact does not exist.
