Skip to content

Instantly share code, notes, and snippets.

@cgoldsby
Last active September 6, 2017 20:34
Show Gist options
  • Save cgoldsby/3a05ec08da929ce0a5bd3fed0bc705c9 to your computer and use it in GitHub Desktop.
Save cgoldsby/3a05ec08da929ce0a5bd3fed0bc705c9 to your computer and use it in GitHub Desktop.
func myFunction() {
return { print("All done") }() // Inline closure
}
func myFunction() {
return () // () -> Void
}
func myFunction() {
return Void() // Compiles!
}
// MARK: - Does not compile
func myFunction() {
return Void // Does not compile since Void is a type (alias). Even though Void = ()
}
func myFunction() {
return // Function must be on the same line to compile
print("Does not compile") // warning: expression following 'return' is treated as an argument of the 'return'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment