Created
June 12, 2015 12:21
-
-
Save konrad1977/e9091c25b629410eb26e to your computer and use it in GitHub Desktop.
guard statement
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
| func greetingsForOptionals(name: String?) { | |
| guard let unwrappedName = name where unwrappedName.characters.count != 0 else { | |
| return | |
| } | |
| print("Greetings \(unwrappedName)") | |
| } | |
| var name: String? = "FooBar" | |
| greetingsForOptionals(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment