Skip to content

Instantly share code, notes, and snippets.

@albtsantos
Created August 2, 2014 22:09
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 albtsantos/68f447cacde708523048 to your computer and use it in GitHub Desktop.
Save albtsantos/68f447cacde708523048 to your computer and use it in GitHub Desktop.
Decrement operator for Swift arrays
@assignment @prefix func -- <T> (inout a: [T]) -> [T] {
if a.count > 0 {
a.removeLast()
}
return a
}
var names: [String] = ["iPhone", "iPad", "iPod", "Nexus"]
--names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment