Skip to content

Glossary: Swift Basics

guard

Also written: guard let

Checks that something is true and, if not, runs an `else` block that must leave the function, usually with `return`. `guard let` unwraps an optional that stays available for the rest of the function.

Where the book teaches it

Related terms

if letoptionalreturn