Skip to content

Instantly share code, notes, and snippets.

@m4scosta
Created December 3, 2015 12:20
Show Gist options
  • Save m4scosta/69fbcb2d417b7bbf77f2 to your computer and use it in GitHub Desktop.
Save m4scosta/69fbcb2d417b7bbf77f2 to your computer and use it in GitHub Desktop.
var a = [1, 4, 6, -1, -7, 8]
let ordered = a.sort({(b: Int, c: Int) -> Bool in return b > c })
let reversed = a.sort({b, c in return b > c})
let shortReversed = a.sort({ $0 > $1 })
let veryShortReversed = a.sort(>)
print(ordered)
print(reversed)
print(shortReversed)
print(veryShortReversed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment