When and Then: The Case Statement


#1

puts "Hello there!"
greeting = gets.chomp

Add your case statement below!

case greeting
when "English" then puts "Hello!"
when "French" then puts "Bonjour!"
when "German" then puts "Guten Tag!"
when "Finnish" then puts "Haloo!"
else puts "I don't know language!"
end

When I type spanish to the console, this comes up:

Hello there!
Spanish
I don't know language!
nil

Which is correct but, I have warning at the bottom:

Oops, try again. It looks like your program doesn't default to printing 'I don't know that language!'

Please help what is wrong?


#2

Compare the error message to your output. See the difference? Some lessons are literally expecting the text given in the instructions.