Skip to content

Glossary: Go Basics

if and else

Also written: if, else, else if

`if` runs a block only when its condition is `true`, `else if` tests further conditions, and `else` covers the rest. Go runs the first block that matches.

Where the book teaches it

Related terms

switch