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 returnsfalseand does not overwrite the number; otherwise, it adds the contact and returnstrue.get_contact(name): Retrieves the phone number for a givenname. If the contact does not exist, it returnsnil.delete_contact(name): Deletes a contact with the specifiedname. Returnstrueif the contact was successfully deleted andfalseif the contact does not exist.
