Last active
August 29, 2015 14:02
-
-
Save abhibeckert/2a9006d3f24a0937a932 to your computer and use it in GitHub Desktop.
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
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