Daily iOS
Memory and ARC

How closure capture works

What actually happens in memory when a closure captures an outside variable? Using the output of the code below, explain the difference between using a capture list [x] and not using one.

var count = 0
let a = { print(count) }
let b = { [count] in print(count) }
count = 10
a(); b()

Submit