Created
August 2, 2014 22:09
-
-
Save albtsantos/68f447cacde708523048 to your computer and use it in GitHub Desktop.
Decrement operator for Swift arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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