Created
August 11, 2018 01:53
-
-
Save mildocjr/e9ccc907b0707da660e64d13e33bea90 to your computer and use it in GitHub Desktop.
if-let-1
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
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