Sobes.tech
Junior — Senior

What will appear in the console after calling the chain of closures

livecode

Task condition

Question: What value will be output to the console after executing all closures?

var total = 0
let actions = [ { total += 1 }, { total += 2 }, { total += 3 } ]

actions.forEach { $0() }
print(total)

Explain how the variable total changes with each closure call and what number will be printed.