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
casestatement in CoffeeScript. You wantswitch— thecasekeyword is the JavaScript equivalent ofwhen, 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.