Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS What's New in Swift 2.0

Toby Morgan
.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
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