Last active
December 12, 2016 07:53
-
-
Save rmnblm/decb24b833520d61b8622790691da88e to your computer and use it in GitHub Desktop.
Swift: Optionals Part 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
var text: String? | |
print(text) | |
// Output: nil | |
print(text ?? "B") | |
// Output: B | |
text = "A" | |
print(text ?? "B") | |
// Output: A | |
print(text) | |
// Output: Optional("A") | |
print(text!) | |
// Output: A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment