Update not updating


So my code runs, but codecademy says its not and it is really confusing any and all help appreciated.

movies = {
"the amazing spiderman".to_sym => 5

puts "What would you like to do?"
puts "--- Add"
puts "--- Update"
puts "--- Display"
puts "--- Delete"
choice = gets.chomp.downcase

case choice
when "add"
puts "Give a title please."
title = gets.chomp.to_sym.downcase
if title == movies[title].nil?
puts "Now a rating."
rating = gets.chomp.to_i
movies[title] = rating.
puts "The movie has been added!"
puts "I already have that movie in my database."
when "update"
puts "What movie would you like to update?"
title = gets.chomp.downcase
if title == movies[title].nil?
puts "That movie is not in my database!"
puts "What would you like to change your rating to?"
rating = gets.chomp.to_i
movies[title] = rating
puts "Your rating has been changed."
when "display"
puts "Movies!"
when "delete"
puts "Deleted!"
puts "Error!"


Never mind I just needed to turn the gets.chomp.downcase into gets.chomp.to_sym.downcase


When I enter my code, it always puts the if statement, and never, runs else for some reason:

when "update"
  puts "Movie title? "
  title = gets.chomp
  if movies[title].nil?
    puts "You've made a mistake"
    puts "What rating does it have?: "
    rating = gets.chomp

What could be the problem?


i have the same problem help