Skip to content

Glossary: Rust Basics

if / else

Also written: if, else if, else

`if` runs a block only when its condition is `true`; `else if` tests more conditions in turn and `else` runs when none was true. An `if` with an `else` also produces a value.

Where the book teaches it

Related terms

ConditionboolBlock