Prompting redux: where is the rating prompt?


<In what way does your co
de behave incorrectly? Include ALL error messages.>
I have two questions that I'm hoping someone could help with.

  1. When I add a movie without the if/else statement included, the program does not run the puts statement asking for a rating.

  2. Can anyone tell me how #{movies[title.to_sym]} produces the rating for the requested movie? It appears that we are calling the title, not the rating.

Thanks, all you smart, beautiful people!!

choice = gets.chomp.downcase
case choice
when 'add'
  puts "What movie do you want to add?"
  title = gets.chomp
  if movies[title.to_sym].nil?
    puts "What's the rating? (Type a number 0 to 4.)"
    rating = gets.chomp
    movies[title.to_sym] = rating.to_i
    puts "#{title} has been added with a rating of #{rating}."
    puts "That movie already exists! Its rating is #{movies[title.to_sym]}."


Oops, i just found a stupid mistake! Forget question 1. I had an "invisible" equals sign in my code.


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