Skip to content

Instantly share code, notes, and snippets.

@terinjokes
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terinjokes/28c71e665201d3f97040 to your computer and use it in GitHub Desktop.
Save terinjokes/28c71e665201d3f97040 to your computer and use it in GitHub Desktop.
// anonymous function
numbers.map({
(number: Int) -> Int in
let result = 3 * number
return result
})
// implicit return for single statements
numbers.map({ number in 3 * number })
// refer to parameters by number
sort([1, 5, 3, 12, 2]) { $0 > $1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment