Reputation: 5095
In the subsection Capturing Values of the section Closures, Apple's book The Swift Programming Language says
The closure can then refer to and modify the values of those constants and variables from within its body, even if the original scope that defined the constants and variables no longer exists.
Upvotes: 0
Views: 49
Reputation: 41226
It should be written as "refer to constants and refer to and modify variables" Try the following in a playground:
let x = 1
println(x)
{ x = x + 1 }()
println(x)
Upvotes: 1