09/10 Delete Won't Delete!


I am stuck on "Delete" Test #9. For some reason my delete function keeps coming up with the "else" statement message.

Replace this line with your code. 
Here is my code:

movies = {
    "Fight Club" => 5,
    "The Namesake" => 4.5,
    "Pest" => 3.5

puts "What would you like to do?"
puts "Add a movie:"
puts "Update a movie:"
puts "Display all movies:"
puts "Delete a movie:"
choice = gets.chomp
case choice
when "add"
puts "Name your new movie!"
title = gets.chomp
if movies[title.intern].nil?
    puts "Give it a rating from 0-5"
    rating = gets.chomp
    movies[title.intern] = rating.to_i
    puts "Okay! Your movie is added to the list!"
    puts {"#{title} already exists!"}
when "update"
puts "Which movie would you like to update?"
title = gets.chomp
if movies[title].nil?
    puts "The movie #{title} is not in our database. Try again."
    puts "What is the new rating for this movie?"
    rating = gets.chomp
    puts "Great we will alter the rating in the database for #{title} right now!"
when "display"
movies.each do |movie,rating|
    puts "#{movie}: #{rating}"
when "delete"
puts "Which title would you like removed from the database?"
title =  gets.chomp
if movies[title.to_sym].nil?
    puts "That movie is not in the database. Try another choice?"
    puts "Okay. the movie #{title} has been removed from the database."
    puts "Error!"


.delete() is a method.


Thank you for that I'm dumb lol but the problem is it is still saying the (else) statement message that "the movie isn't in the database" even though it is.......


What code do have now for,

    when "delete"



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.