typeover
curriculum

Curriculum Foundations Conditionals & switch exercise 5 · fill-word

Conditionals & switch

Theme 4 exercise 2 covered the short-statement-if form. Now write the comparison: fill in the operator and the nil literal that Go uses for "result of this call is empty/not-found."

TypeScript reference
Fill the blanks →

About this theme

if/else looks familiar — no parentheses, braces required. The one new shape is the short-statement-if: if err := work(); err != nil { ... }. It scopes a temporary to the condition; you'll see this everywhere in Go. switch exists and doesn't fall through by default — closer to TypeScript's switch with implicit break than to C's.