3 - The Case Statement



Below is my code. It’s running and returning ‘Movies!’, regardless of what the user types in.


movies = {
  'Truman Show' => '8/10'

puts "What would you like to do?"
answer = gets.chomp

# puts "The user said they wanted to #{answer}"
case choice
  when "add"
  	puts "Added!"
  when "update"
  	puts "Updated!"
  when "display"
  	puts "Movies!"
  when "delete"
  	puts "Deleted!"
  	puts "Error!"


Turns out I was missing a bit of code from the last step, the choice = gets.chomp


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