Skip to content

Instantly share code, notes, and snippets.

@fletcherm
Created April 1, 2011 12:37
Show Gist options
  • Save fletcherm/898083 to your computer and use it in GitHub Desktop.
Save fletcherm/898083 to your computer and use it in GitHub Desktop.
window.Matt = {}
Matt.Printer = (->
message1 = "Yo ho ho"
message2 = "Five dwarves"
print1 = ->
console.log message1
print2 = ->
console.log message2
{
print1: print1
print2: print2
}
)()
@misfo
Copy link

misfo commented Sep 23, 2011

There's also the do keyword for immediately executing function expressions: https://gist.github.com/1238400. Makes the example a little bit nicer

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