4. Prompting: Redux!


#1

I'm giving my code below, but I don't know how to add the movie/rating pair to the movies hash. In fact I have no idea how to do this and I don't believe I have been told this before. Please can someone help me with the syntax required to add title and rating to the hash, thank you.

movies = {
'Citizen Kane' => 5,
}
puts "Do you like movies?"
choice = gets.chomp
case choice
when "add"
puts "What\'s your favourite movie?"
title = gets.chomp
puts "How would you rate this movie?"
rating = gets.chomp
puts title + rating["Citizen Kane"]
when "update"
puts "Updated!"
when "display"
puts "Movies!"
when "delete"
puts "Deleted!"
else
puts "Error!"
end


#2

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