5. Not My Type (How does this work!)



Oops, try again. Did you call .to_sym on title and .to_i on rating before adding them to the hash?

This is the error message I keep getting. I don't know where to put the to_sym or to_i.

movies = {
    'Inception' => '4'
puts "What would you like to do?"

choice = gets.chomp
case choice
when "add" 
    puts "Movie title!" 
    title = []
    title = gets.chomp
when "update"
    puts "Rating!"
    rating = []
    rating = gets.chomp
    movies["title"] = rating
    puts "You added #{title} and #{rating}."
when "display"
    puts "Movies!"
when "delete"
    puts "Deleted!"
    puts "Error!"

Here's what I have. How do I do it? Thanks


This is not an in place operation. It needs to be assigned to a variable, passed as an argument to a method, or used to reference a hash.

movies[title.to_sym] = rating.to_i

Suggest go back to lesson 1 and review the example so you include all the steps in your code.


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