jazzedge
12/1/2017 - 9:22 PM

Swift - Guard statement

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
    }