Key/value doesn't get added to the Hash


#1

Hi! I'm stuck on the Night at the Movies exercise, "Prompting: Redux!"

It keeps telling me "Oops, try again. It looks like you didn't add to the movies hash!" I don't understand what's wrong.. Can anyone help? Here's my code:

movies = {
    Frozen: 5,
    Batman_begins: 5,
    Birdman: 1
    }
puts "Please put ADD to start rating movies!"
choice = gets.chomp

case choice
when "add" 
    puts "What movie would you like to rate?"
    title = gets.chomp
    puts "How would you like to rate this movie?"
    rating = gets.chomp
    movies[title] = rating
    puts "#{title} has been added with the rating #{rating}"
when "update"
    puts "Updated!"
when "display"
    puts "Movies!"
when "delete"
    puts "Deleted!"
else
    puts "Error!"
end


#2

What is your exact input after you start the program?


#3

HI When you Save & submit the code you should first type add the type the name of the movie you want to add..


#4

Hey!

This is what I get ont he console:

Please put ADD to start rating movies!

Error!
nil


#5

oh man... you were right, ugh I fell so stupid now :smiley: Thanks for your help :slight_smile:


#6

Yah, so you have to give your program some input and you'll be fine. Do "add" then add some movies ^^


#7

Thank you! :blush: sometimes all you need is an new eye to evaluate the situation lol