0
In ruby, I m using here class instead of age , it is showing syntax error, why?please help
class = 12 case class when 1,4,7 puts "primary students" when 5,9,11 puts "secondary students" else puts "professionals" end https://www.sololearn.com/discuss/2107118/?ref=app
2 Answers
0
Because "class" is a reserved word. Just like any other reserved word, you can't use it as a variable. Instead, use for example "age". Then your program will be fine.
0
Thanks