Created
December 21, 2016 07:40
-
-
Save josephchang10/7fa337fc9147fcba18846a9298270163 to your computer and use it in GitHub Desktop.
输入输出参数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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