Junior — Senior
What output will we get in this example №3
livecode
Task condition
This code snippet demonstrates how a closure captures a struct object and attempts to modify its property. You need to understand what value will be printed after executing the closure.
struct IntegerBox {
var value: Int
init(_ value: Int) {
self.value = value
}
}
var firstInt = IntegerBox(10)
let closure = { [firstInt] in
firstInt.value = 77
}
closure()
print(firstInt.value)