Skip to content

Instantly share code, notes, and snippets.

@rmnblm
Last active December 12, 2016 07:28
Show Gist options
  • Save rmnblm/8825917a6789979e66387f8d7cea2cc8 to your computer and use it in GitHub Desktop.
Save rmnblm/8825917a6789979e66387f8d7cea2cc8 to your computer and use it in GitHub Desktop.
Swift: Guards
// 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