Skip to content

Instantly share code, notes, and snippets.

@josephchang10
Created December 21, 2016 07:40
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 josephchang10/7fa337fc9147fcba18846a9298270163 to your computer and use it in GitHub Desktop.
Save josephchang10/7fa337fc9147fcba18846a9298270163 to your computer and use it in GitHub Desktop.
输入输出参数
func swapTwoInts(_ a: inout Int, _ b: inout Int) {
let temporaryA = a
a = b
b = temporaryA
}
var someInt = 3
var anotherInt = 107
swapTwoInts(&someInt, &anotherInt)
print("someInt 现在是 \(someInt),anotherInt 现在是 \(anotherInt)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment