2 ms·
> doSomething (-> > 'hello'), 1 > Indentation is significant in CoffeeScript, just like it is in Python. Just having a parenthesis shouldn't change that. Th
by aes 14y ago
> doSomething (->
> 'hello'), 1
> Indentation is significant in CoffeeScript, just like it is in Python. Just having a parenthesis shouldn't change that.
The point, I think, is that the example above should be an error instead of compiling into something you wouldn't expect.
Here's a syntax I've seen a lot:
doSomething ->
'hello'
, 1
or even
doSomething ->
'hello'
,
1
That style is also handy to construct a long list of object literals.
> This is called destructuring assignment,
I think destructuring assignment is something else entirely. http://coffeescript.org/#destructuring http://coffeescript.org/#destructuring
> its probably better to use isnt instead of !=, although rather than !=, you would want !==
'!=' is equivalent to 'isnt'. And '!==' is not CoffeeScript at all.