What just happened?is this a bug?refactoring case statement


#1


<In what way does your code behave incorrectly? Include ALL error
messages.>


here's my code:
puts "What's your favorite language?"
language = gets.chomp

when language == "Ruby" then puts "Ruby is great for web apps!"
when language == "Python" then puts "Python is great for science."
when language == "JavaScript" then puts "JavaScript makes websites awesome."
when language == "HTML" then puts "HTML is what websites are made of!"
when language == "CSS" then puts "CSS makes websites pretty."
else
  puts "I don't know that language!"
end
and here's the problem:
(ruby):3: syntax error, unexpected keyword_when, expecting $end
when language == "Ruby" then puts "Ruby is great for web apps!"
    ^
please help and that would be appreciated.


#2

you missed something.check the case statement syntax again :slight_smile:


#3

what is this thing?i got the when,the then, and the end


#4

ohhh finnally got it, the case itself!thanks man much appreciated


#5

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