Skip to content

Glossary: Swift Basics

if and else

Also written: if, else, else if

`if` runs a block only when a condition is true. `else if` adds another check and `else` covers everything else; an `if` can also be an expression that gives a value.

Where the book teaches it

Related terms

expressionblock