Prompting: Redux! (Recurring Error : Did you create a variable called title?)


#1

https://www.codecademy.com/courses/ruby-beginner-en-0i8v1/0/4?curriculum_id=5059f8619189a5000201fbcb

These are the errors I'm currently receiving:
Oops, try again. Did you create a variable called title?
(ruby): syntax error, unexpected tIDENTIFIER, expecting $end
...auty and the Beast" => 3} puts "What is your favourite movi...
...

Does anyone know how to prevent / fix this, as it wasn't initially giving me this error message, and then when I tried changing some of the syntax to be more "efficient" this one popped up! I have refreshed the page several times as was suggested in this post, to no avail (https://discuss.codecademy.com/t/4-prompting-redux-help/3250).

Thanks in advance for your help!

My code is below:

movies = {"The butterfly effect"=>4, "Beauty and the Beast" => 3}

puts "What is your favourite movie?"
choice = gets.chomp

case choice
when "add"
    puts "Provide a movie title."
    title = gets.chomp
    puts "What is the movie's rating?"
    rating = gets.chomp
    puts "That pair was just added!"
    movies [title] = rating
when "update"
    puts "Updated!"
when "display"
    puts "Movies!"
when "delete"
    puts "Deleted!"
else
    puts "Error!"
end

#2

Here's another problem:

$ ruby snaylz.rb 
What is your favourite movie?
bob eats dinner
Error!

Other than that I'm not sure how I would reproduce what you describe, perhaps you posted the wrong code.


#3

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