Help!?


#1



Night at the Movies, 4 Redux!
Message is saying I didn't add movie to the hash, but my code looks the same as others I have viewed in this forum, but something isn't working!


this is my error message: Oops, Looks like you didn't add to the movies hash!


movies = { 
    "Sixteen Candles" =>  4
}

puts "What is your favorite movie?"
choice = gets.chomp
case choice
when "add" 
    puts "Name a movie"
    title = gets.chomp
    puts "Rate this movie from 0 to 4"
    rating = gets.chomp
    movies[title] = rating
    puts "Your movie #{title} and rating #{rating} was         added to database."
    
when "update"
    puts "Updated!"
when "display"
    puts "Movies!"
when "delete"
    puts "Deleted!"
else
    puts "Error!"
end


#2

The first input should be a command choice, namely,

puts "Enter the action you wish to take: "

In this lesson that choice will be add, at which point you are prompted for a movie title.


#3

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