Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS What's New in Swift 2.0

Toby Morgan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Toby Morgan
iOS Development Techdegree Graduate 23,133 Points

Defer Statements Mistake

In the video "What's New in Swift 2.0" Prasan discusses Defer statements and says that multiple Defer statements are executed in the order they are written, but having just completed the Swift 2.0 track where Defer statements are also discussed he stated they are executed in reverse order. One or the other video needs a call out for correction. Thanks.

pretty sure the course would be right, but just in case I'll add Pasan Premaratne

1 Answer

Pasan Premaratne
STAFF
Pasan Premaratne
Treehouse Teacher

Hey Toby Morgan,

The correct answer is that they are executed in reverse order. The what's new in Swift 2.0 workshop was made while Swift 2 was still in beta. I can't remember exactly if the behavior was different at that point but I'll correct that. Thanks for the heads up