3 ms·
I converted some of my javascript to coffeescript last night, and the one thing that I still feel weird about is not having void functions. I have been instead
by MatthewPhillips 16y ago
I converted some of my javascript to coffeescript last night, and the one thing that I still feel weird about is not having void functions. I have been instead ending those functions with null, but it feels weird. Is it not the "coffeescript way" to have void style functions at all? I should try to convert these to expressions?
- jashkenas 16y agoIdeally, every function you write returns a meaningful value ... even if that function is used for nothing more than side effects, and that value is just "true", or "null". To create a void function in CoffeeScript, just add a naked "return" as the final line. sideEffecty = -> do something do somethingElse return