5. Not my type


#1

I'm being told 'can't convert string into integer'. I also didn't really understand the last stage because I didn't understand how to add the user input to the hash, but no one got back to me when I asked. Please please help!

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.to_sym + rating.to_i["Citizen Kane"]
when "update"
puts "Updated!"
when "display"
puts "Movies!"
when "delete"
puts "Deleted!"
else
puts "Error!"
end


#2

puts translates to print string. At this stage we want to be updating the database, not printing.

movies[title.to_sym] = rating.to_i

#3

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