Skip to Content

Operators and Control Flow

This part covers the language’s expressions and statements: operators and precedence, conditionals and matching, loops, patterns, and more.

OperatorsExpressions are joined by operators. This page goes through all of them family by family; precedence rules are collected at the end.
Ifif has four uses: conditional statement, conditional expression, conditional binding, and type-test entry point. The condition slot accepts only a bool; an integer or any other type is not allowed there.
Matchmatch tests one value against a sequence of patterns and runs whichever arm matches. It is both an expression and a statement, and the two forms share the same matching machinery and exhaustiveness checking. Every pattern form is on the Pattern page.
PatternA pattern is a description of a value's shape. match arms, if val, while val, expect, for iteration variables, and destructuring bindings all share one pattern machinery; this page lists all of it in one place.
LoopsLoops have four entry points: for iterates over iterable values, while over a condition, while val over a conditional binding, and repeat over a fixed count. The ways out are uniformly break and continue; complex nesting uses a label to name the jump target.
Deferdefer registers a statement as a cleanup hook that must run before the current block is left. Nothing executes at registration; execution runs in reverse order. Resources with a Dispose protocol go through using; every other wrap-up scenario goes through defer.
FailFailure is typed control flow: an error value is thrown with fail, travels up the call chain, and every call site is checked by the compiler for its consumption obligation. The language has no exceptions: failures never happen silently outside the types, and there is no try-catch safety net to fall back on.
Crashcrash says that carrying on makes no sense.
EffectEffects are interceptable side effects: effect declares a set of operations (ops), function bodies trigger them with perform, and callers intercept with handle and continue with resume.
Last updated on October 11, 2026