Oops, try again. It looks like you didn't add *title* to the movies hash!


#1

puts "what's your choice?"
choice=gets.chomp

case choice
when "add"
title=gets.chomp #title-that is whats problem#
rating=gets.chomp
end
puts movies ={
title: rating
}


#2

No, your gets.chomp lines are not the problem at all.

You have two problems on this part:

puts movies ={
    title: rating
    }

First, you're trying to puts the hash instead of simply modifying it, and second, you're assigning a brand new hash with your new movie in it, instead of adding your movie to the already existing hash.

Oh and also, you can't add title as a symbol unless you use a conversion (because the user will provide you with strings, not symbols).

So if it's the part where you need to convert to symbols, use to_sym, look in the instructions if it's asked or not.


#3

Thank you, that was very useful!!
can i ask u one more quastion:
whats bad in not "simply modifying" hash.
I assume that the changes in this way will not be recorded in the memory?

1.
movies[title]=rating
puts movies[title]

2
puts movies[title]=rating


#4
movies[title]=rating
puts movies[title]

This adds a movie with title as key and rating as value inside the movies hash.
Then it puts the value.

puts movies[title]=rating

I'm not sure what this would do. You're attempting to puts an assignation, not sure it will effectively modify the hash, or if it will display anything.