Skip to content

Instantly share code, notes, and snippets.

@khanlou
Created August 7, 2016 23:29
Show Gist options
  • Select an option

  • Save khanlou/4b1ad88528ad1256e4c357b0034c68fc to your computer and use it in GitHub Desktop.

Select an option

Save khanlou/4b1ad88528ad1256e4c357b0034c68fc to your computer and use it in GitHub Desktop.
func doThing(defaultable value: Int = 4, _ required: Void -> Int) -> Int {
return value + required()
}
doThing(defaultable: 4, { 6 }) // works
doThing { 6 } // works
doThing({ 6 }) // doesn't compile: Missing argument for parameter #2 in call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment