Redux


#1



Replace this line with your code.


#2

movies = {
    Titanic: 4,
    Elephant: 5,
    Isharkar: 3
}
puts "What Movie would you love to watch?"
choice = gets.chomp.downcase
case choice
when 'add'
  puts "What movie do you want to add?"
  title = gets.chomp
  if movies[title.to_sym].nil?
    puts "What's the rating? (Type a number 0 to 4.)"
    rating = gets.chomp
    movies[title.to_sym] = rating.to_i
    puts "#{title} has been added with a rating of #{rating}."
  else
    puts "That movie already exists! Its rating is #{movies[title.to_sym]}."
  end 

when "update"
   puts "Updated!"
when "display"
   puts "Movies!"
when "delete"
   puts "Deleted!"
 else 
   puts "Error!"
end

#3

What could be the problem with my code?


#4

Please read the fourth instruction carefully:

Add that movie/rating pair to the movies hash and puts a message indicating the pair was added. (No need for to_sym or to_i just yet!)

Problem spotted? :wink: