Values & References9 / 16
Up next

Swap with inout

func swapValues(_ a: inout Int, _ b: inout Int) {
    let tmp = a
    a = b
    b = tmp
}
var x = 1
var y = 2
swapValues(&x, &y)
print(x, y)
What you're solving

exchange two variables