Swap a b

Run Settings
LanguageSwift
Language Version
Run Command
print("Not using 3rd variable") func swap( a: inout Int, b:inout Int) { a = a + b b = a - b a = a - b } func swapB(_ a: inout Int,_ b: inout Int) { a = a ^ b b = a ^ b a = a ^ b } var a:Int = 5, b = 7 swap(&a, &b) print("number is: ", a, b) swapB( &a, &b) print("swap again:",a, b)
Editor Settings
Theme
Key bindings
Full width
Lines