07.5 Control flow
if, match, loops, and branching without turning every decision into a framework."
Control flow
Control flow is how programs admit they have choices. Beskid expects you to make those choices explicit enough for the analyzer to follow.
Standard conditional binding—exact grammar in lexical and syntax. Do not use if to simulate nullable checks; narrow Option<T> with match.
match is the honest tool for enums and Option<T>:
- Exhaustive arms are a feature, not bureaucracy
- Combine with enums and match for algebraic types
flowchart TD E[enum or Option] --> M[match] M --> A1[arm 1] M --> A2[arm 2] M --> AN[arm n - exhaustive]
Loops and fibers
Section titled “Loops and fibers”Iteration and concurrency primitives live under evaluation features (fibers and spawn etc.). This tutorial does not pretend to be the concurrency bible—read spec before spawning threads because a blog post said async.
Control flow vs effects
Section titled “Control flow vs effects”Branching across contract boundaries may interact with effect tracking—when in doubt, beskid analyze and read the diagnostic rather than guessing.