Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created September 29, 2011 19:10
Show Gist options
  • Save ryanflorence/1251639 to your computer and use it in GitHub Desktop.
Save ryanflorence/1251639 to your computer and use it in GitHub Desktop.
CoffeeScript Immediately Invoked Function Expressions
increment = do ->
x = 0
->
x++
var increment = (function (){
var x = 0;
return function (){
return x++;
}
}());
@mindscratch
Copy link

@Kilimangaro nice! 👍

@Pontusfa
Copy link

I'm late on the like-train but still: thumbs up!

@EvidentlyCube
Copy link

Characters reduced by: 62.5%
Readability reduced by: 80%

@ericelliott
Copy link

How does this reduce readability? I think do -> reads just fine...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment