snowscript
snowscript copied to clipboard
Implicitly return value maybe?
To be able to write something like:
fn fact(n)
if n <= 1
1
n * fact(n - 1)
i've been there, and I'm not sure I like it.
This is a functionality present in CoffeeScript, and it can get a bit confusing. For instance, this quite simple to understand:
my_var = if it is 0
'ok'
else
'stars'
But for new-comers, this might not be the case (specially for large code blocks):
say_it = (right, now) ->
as = 'if it'
(were, real) ->
if such?.fail is right
return as + real
now
I strongly suggest NOT to do it, and never to think about it again. It's nice when you're lazy, and in some cases can improve code readability, but... just, no.