Code runs properly but I get an error telling me it doesn't


#1




When running the code, I get the following error message:
"Oops, try again. It looks like your case statement doesn't puts 'Error!' when it gets unexpected input. "
But when I run the code, it works fine, any time I type in a bunch of random stuff it prints "Error!" like it should, though I still get an error telling me that it doesn't put Error. In fact, I get the same error for any option. The command line outputs "added!" when I give it 'add' as my input, but it tells me it doesn't work....even though I can see it working.


movies = {
    labyrinth: 10
}

puts "Enter something:"
print "> "
choice = gets.chomp

case choice
when "add"
    puts "Added!"
when "update"
    puts "Updated!"
when "display"
    puts "Movies!"
when "delete"
    puts "Deleted!"
else
    puts "Error!"
end


#2

Nevermind, I figured it out.
It was the line
print "> "
Although I don't understand why that would cause the errors, but whatever


#3

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