5. Not My Type - Stuck on this!


#1



Keep getting an error of: Oops, try again. Make sure to test your program by choosing 'add'.

Don't understand what i'm doing wrong - I've tried fiddling around with my code but I keep getting an error message.


movies = {
    Marvel: 4,
    Transformers: 3,
    The_Minions: 4
}
puts "what would you like to do?"
choice = gets.chomp
case title 
when "add"
puts "what is the title?"
title = gets.chomp
if movies[title.to_sym].nil?
puts "what is the rating?"
rating = gets.chomp
movies[title.to_sym] = rating.to_i
puts "#{title} has been added with a rating of #{rating}."
  else
    puts "That movie already exists! Its rating is #{movies[title.to_sym]}."
  end
when "update"
puts "Updated!"
when "display"
puts "Movies!"
when "delete"
puts "Deleted"
else 
    puts "Error!"
end


#2

Here:

It should be:

choice = case

#3

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