How to add a hash


12. A Night at the movies lesson 4.

Oops, try again.
It looks like you didn't add to the movies hash!. Thats the error i get but i don't know how i add the hash. The example in the lesson did not help. it looks like the example is not adding a hash but adding numbers.. and i thought adding a hash is somethin like getting that chomped film into your hash or isn't it?

movies = {
    "Persepolis" => 4,
    "blabla" => 3,
puts "Rate your favorite film."
choice = gets.chomp

case choice
when "add"
    puts "Gib einen Filmtitel ein."
    title = gets.chomp
    puts "What's the rating? (Type a number 0 to 6.)"
    rating = gets.chomp
    movies[title] = rating #don't understand how to add the hash here
    puts "#{title} has been added with a rating of #{rating}."
when "update"
    puts "Updated!"
when "display"
    puts "Movies!"
when "delete"
    puts "Deleted!"
    puts "Error!"


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