Skip to content

Instantly share code, notes, and snippets.

@Danappelxx
Created January 29, 2016 19: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 Danappelxx/f39ed35ae39dce43fc6d to your computer and use it in GitHub Desktop.
Save Danappelxx/f39ed35ae39dce43fc6d to your computer and use it in GitHub Desktop.
postfix operator +++ {}
postfix func +++(inout x: Int) -> Int {
let y = x
x += 1
return y
}
var i = 0 // -> 0
i+++ // -> 0
i // -> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment