7.Update


#1

Please see my code below.
I am getting a pass with this BUT when I am doing the update and I input 'dumbo', I always get the 'IF' response saying that movie is not listed. Can anyone point out where I am going wrong with this? I don't want to move forward knowing that something isn't working right. Thanks V much. :slightly_smiling:

movies = {
//// "dumbo" => 4
}

puts "Do you want to: Add, Update, Display or Delete?"
choice = gets.chomp

case choice
when "add"
//// puts "What movie?"
//// title = gets.chomp
//// if movies[title.to_sym].nil?
//////// puts "What rating? (0-5)"
//////// rating = gets.chomp
//////// movies[title.to_sym] = rating.to_i
//////// puts "#{title} added with rating of #{rating}."
//// else
//////// puts "Already listed"
//// end

when "update"
//// puts "Which movie?"
//// title = gets.chomp
//// if movies[title.to_sym].nil?
//////// puts "This movie is not listed"
//// else
//////// puts "What's the new rating?"
//////// rating = gets.chomp
//////// movies[title.to_sym] = rating.to_i
//// end

when "display"
//// puts "Movies!"
when "delete"
//// puts "Deleted!"
else
//// puts "Error!"
end


#2

Sorted,

After looking at, and having the same problem with, section 9 of this topic I changed my ** .nil?** to == nil? and it now updates the movie rating.