Skip to content

Instantly share code, notes, and snippets.

@tmm
Last active December 17, 2017 21:20
Show Gist options
  • Select an option

  • Save tmm/a3ecbe903496381ab1ee to your computer and use it in GitHub Desktop.

Select an option

Save tmm/a3ecbe903496381ab1ee to your computer and use it in GitHub Desktop.
swap numeric variables without a third
var a = 5
var b = 3
a += b
b = a - b
a = a - b
print("a: \(a)") // 3
print("b: \(b)") // 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment