> On Nov 9, 2016, at 11:45 PM, Rien <r...@balancingrock.nl> wrote:
>
> The manual says this:
>
> https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html
>
> <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html>
>
> A defer statement is used for executing code just before transferring program
> control outside of the scope that the defer statement appears in.
>
> The scope of a for loop ends when the loop ends.
Right, more specifically, it is the “static” scope that it is defined in. Go
has a similar but different defer statement, which runs defer'd actions at the
end of the current dynamic *function* scope. The Swift rules are simpler, more
predictable, and are able to be implemented more efficiently.
-Chris
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users