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.

Revisions

  1. tmm revised this gist Dec 17, 2017. No changes.
  2. tmm revised this gist Apr 29, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions swap.swift
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    var a = 100
    var b = -12
    var a = 5
    var b = 3
    a += b
    b = a - b
    a = a - b
    print("a: \(a)\n")
    print("b: \(b)\n")
    print("a: \(a)") // 3
    print("b: \(b)") // 5
  3. tmm created this gist Oct 29, 2015.
    7 changes: 7 additions & 0 deletions swap.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    var a = 100
    var b = -12
    a += b
    b = a - b
    a = a - b
    print("a: \(a)\n")
    print("b: \(b)\n")