Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Of course you could always add parentheses for clarity, which in some cases is a good idea, althought most times it’s best to just split the expression into multiple expressions and take advantage of naming variable.

But for simple logic expressions like the one you mentioned, this is just something programmers are expected to just learn early on.

But for simple logic expressions like the one you mentioned, this is just something programmers are expected to just learn early on.

Or they simply don’t question it at all. Of course, when in doubt, you would use parentheses, but otherwise, statements in CoffeeScript follow the logic of regular speech. if not invincible and hp <= 0 reads naturally and evaluates in an intuitive, expected manner.

(1 edit)

Also YES, CoffeeScript is great at teaching you how not to cram everything into one-liners 💪