-
-
Save nickarthur/3e8a772050db1052eae2a82dfcc389e0 to your computer and use it in GitHub Desktop.
if-let-1
This file contains hidden or 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
| if let actualInteger = possibleInteger as? Int { | |
| // do stuff with actual integer | |
| print(actualInteger) // prints 3 | |
| print(possibleInteger) // prints Optional(3) | |
| // actualInteger's scope ends here | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment