Creazy for "Oops, try again. It looks like you didn't add car to the movies hash!"


#1

here is my code:
movies = { war_3: 1,
war_2: 2
}
puts "What do you want (add update display delete)?"
choice=gets.chomp.downcase
case choice
when "add"
puts "Please input the movie's name!"
title = gets.chomp
if movies[title.to_sym].nil?
puts "Please input the rating!"
rating = gets.chomp
movies[title.to_sym] = rating.to_i
puts movies
else
puts "The movie is exist!"
end
when "update"
puts "update!"
when "display"
puts "Movies!"
when "delete"
puts "Deleted!"
else puts "Error!"
end

input title car rating 2 ,but still let me try again! :joy:


#2

ok ,fixed it
change 'movies[title.to_sym] = rating.to_i '
to 'movies[title] = rating'
but don't know why!~