Skip to content

Instantly share code, notes, and snippets.

@jazzedge
Created December 1, 2017 21:22
Show Gist options
  • Save jazzedge/d89bee85eb698b06605831bc43ec370e to your computer and use it in GitHub Desktop.
Save jazzedge/d89bee85eb698b06605831bc43ec370e to your computer and use it in GitHub Desktop.
The guard statement means "if the condition(s) are NOT met then do this"
The else basically means DO THIS if the condition is NOT met
So if x is not > 0 then the code in { ... } IS executed.
guard x > 0 else {
// Value requirements not met, do something
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment