Almost there! Let’s handle the “delete” part of our case statement, which will remove whatever key the user specifies from the hash. (This will be very similar to what we did for “add” and “update.”)

Ruby makes it easy to remove a movie/rating pair from our hash: we just write movies.delete(title.to_sym)!



Go ahead and remove the puts "Deleted!" when the user types “delete”.

Get the title from the user.

Include an if/else statement that puts an error if the movie’s not in the hash; if it’s there, use .delete to remove it as shown above. Make sure to test it out!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?