Skip to content

Instantly share code, notes, and snippets.

@abhibeckert
Last active August 29, 2015 14:02
Show Gist options
  • Save abhibeckert/2a9006d3f24a0937a932 to your computer and use it in GitHub Desktop.
Save abhibeckert/2a9006d3f24a0937a932 to your computer and use it in GitHub Desktop.
func foo(closure: Void -> Void)
{
closure()
}
// correct syntax
foo({
println("Hello")
})
// convenience syntax
foo {
println("Hello")
}
// incorrect, compiler does not know what "foo" is:
foo
{
println("Hello")
}
// this does work however:
foo(
{
println("Hello")
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment