-
-
Save h4ck4life/6f769426ee29dcfae672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo = (f1, f2) -> | |
f1() | |
f2() | |
# Doesn't work -- syntax error | |
# foo(-> console.log("hi from f1"), -> console.log("hi from f2")) | |
# Simplest way I've found to do it -- newlines added for clarity | |
foo( | |
(-> console.log("hi from f1")), | |
(-> console.log("hi from f2")) | |
) | |
# Most concise way -- you can leave off the parens around the last function (thanks bkad) | |
foo (-> console.log("hi from f1")), -> console.log("hi from f2") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment