6 Error Error! Indeed!


#1



Hello,
I am currently completely stuck getting past this activity. I would really be glad of any help.

I am stuck on Night at the Movies lesson 6.


I can get to the "add" command, and I can type in the name of a movie , but then the error keeps saying that movie "has not been added to the hash with a rating of" in the display screen it says "undefined local variable for movie"


movies = {
    amile: 4
}

puts "What is your favourate film?"

choice = gets.chomp.downcase

case choice 

when "add"
        puts "What is your movie title?"
        title = gets.chomp
   
    if movie[title.to_sym].nil?
        
        puts "What is your rating?"
         rating = gets.chomp 
       movies[title.to_sym] = rating.to_i 
        puts "Movie #{title} and rating #{rating} added"
    else
        puts "Movie already there. Movie #{title} rating is #{rating}"
    end

when "update"
    puts "Updated!"

when "display"
    puts "Movies!"

when "delete"
    puts "Deleted!"
    
else 
    puts "Error!"

end


#2

I have just figured out what was wrong! I was missing an ■■■■ 's' of the end of movies in the if command. I am a muppet.


#3

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