Skip to content

Instantly share code, notes, and snippets.

@milanpanchal
Forked from aciidgh/CSwift.swift
Created February 9, 2017 08:39
Show Gist options
  • Save milanpanchal/dc93a435e9454b41166db992eb1691c7 to your computer and use it in GitHub Desktop.
Save milanpanchal/dc93a435e9454b41166db992eb1691c7 to your computer and use it in GitHub Desktop.
Swift ++ operator
prefix func ++(inout x: Int) -> Int {
x = x + 1
return x
}
postfix func ++(inout x: Int) -> Int {
let oldX = x
x = x + 1
return oldX
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment