Sobes.tech
Junior — Senior

What result will appear in the console (example 3)

livecode

Task condition

Determine what output will be obtained in the console and explain why this happens.


var counter = 0
let closures = [ { counter += 1 }, { counter += 2 }, { counter += 3 } ]

closures.forEach { $0() }
print(counter)