I'm trying to translate this Javascript code:
if(error) {
foo();
return null;
}
bar()
into Coffeescript code, where here bar()
is another long piece of code which I don't want to indent more
Is there a better way than this?
if error
foo()
return null
bar()
Your code looks fine for me.
Though, if you really want it to be a one-liner, you could take advantage of parentheses:
return (foo(); null) if error
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments