Last active
December 12, 2016 07:28
-
-
Save rmnblm/8825917a6789979e66387f8d7cea2cc8 to your computer and use it in GitHub Desktop.
Swift: Guards
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
// Declare an optional variable | |
var name: String? = "Roman" | |
guard let name = name else { | |
print("name is nil") | |
return | |
} | |
print(name) | |
// Output: Roman |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment