In Case of Many Options


#1

I cant understand why I am getting an error here. The error I am getting is:

(ruby):6: syntax error, unexpected tIDENTIFIER, expecting keyword_then or ',' or ';' or '\n'
when "HTML" puts then "HTML is what websites are made of!"
^
(ruby):7: syntax error, unexpected keyword_when, expecting $end
when "CSS" puts then "CSS makes websites pretty."
^


Here is my code:



puts "What's your favorite language?"
language = gets.chomp
case language
when "Ruby" then puts "Ruby is great for web apps!"
when "Python" then puts "Python is great for science."
when "JavaScript" then puts "JavaScript makes websites awesome."
when "HTML" puts then "HTML is what websites are made of!"
when "CSS" puts then "CSS makes websites pretty."
else puts "I don't know that language!"
end


#2

when "HTML" puts then "HTML is what websites are made of!"
when "CSS" puts then "CSS makes websites pretty."

it should be then puts instead of puts then


#3

OMG I just saw that

Thank you so much :slight_smile:


#4

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