Created
June 19, 2015 18:01
-
-
Save Cananito/f9f75076478665e7d2cc to your computer and use it in GitHub Desktop.
defer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func a(x: X) -> A { | |
defer { | |
print("Exiting the function") | |
} | |
if x == something() { | |
return A(x); // Console prints: "Exiting the function" | |
} | |
// Do more stuff | |
if x == other() { | |
return A(x); // Console prints: "Exiting the function" | |
} | |
return A(x); // Console prints: "Exiting the function" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment