Swift - Functions
What will be the output of this Swift code?
func increment(_ number: inout Int) {
number += 1
}
var count = 5
increment(&count)
print(count)What will be the output of this Swift code?
func increment(_ number: inout Int) {
number += 1
}
var count = 5
increment(&count)
print(count)count starts at 5, then increment(&count) increases it to 6, so print(count) outputs 6.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions