Consider this code: ``` var x = 0 repeat(10) { x +...
# getting-started
r
Consider this code:
Copy code
var x = 0
repeat(10) { x += 1 }
After this code block,
x
will be
10
. If the code behaved like you seem to be expecting,
x
would still be
0
after the block, which negates all the benefits you get by having real closures.
👍 1