Created
September 29, 2011 19:10
-
-
Save ryanflorence/1251639 to your computer and use it in GitHub Desktop.
CoffeeScript Immediately Invoked Function Expressions
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
increment = do -> | |
x = 0 | |
-> | |
x++ |
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
var increment = (function (){ | |
var x = 0; | |
return function (){ | |
return x++; | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How does this reduce readability? I think
do ->
reads just fine...