Quiz · Functions · lesson 6 of 9
Quiz — inout
What does the program print?
func plusOne(_ n: Int) -> Int {
n + 1
}
func addTwo(_ n: inout Int) {
n += 2
}
var x = 10
let y = plusOne(x)
addTwo(&x)
print(x, y)What does the program print?
func plusOne(_ n: Int) -> Int {
n + 1
}
func addTwo(_ n: inout Int) {
n += 2
}
var x = 10
let y = plusOne(x)
addTwo(&x)
print(x, y)