Skip to content

Instantly share code, notes, and snippets.

@fadhlirahim
Forked from ryanflorence/cs-iife.coffee
Created July 7, 2012 03:17
Show Gist options
  • Save fadhlirahim/3064214 to your computer and use it in GitHub Desktop.
Save fadhlirahim/3064214 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++;
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment