I'd like to do the following in Haml-Coffee:
- case msg.type
- when "usertext"
= msg.body
- when "direct"
= msg.content.kbcontent_body
But I get an error "Reserved word "case""
I suspect it's not supported by Haml-Coffee actually.
There isn't a case
statement in CoffeeScript. You want switch
— the case
keyword is the JavaScript equivalent of when
, and like many dropped JavaScript keywords is reserved in CoffeeScript. Also, I'm not 100% positive and don't have Haml-Coffee to test right now, but I think you'll need to indent the body of the switch.