Match for scalar values
match compares a value against a list of patterns and hands back a value — think switch, but as an expression, with no fallthrough and no break. Each arm is pattern -> result, and else is the catch-all for “everything not listed above” (there’s no cryptic _).
The subject is parenthesized nowhere — just match value { ... } — and because it’s an expression, you bind its result straight to a slot.
The one rule switch never enforced: a match must cover every possible value. There are infinitely many Ints, so a scalar match can’t list them all — which means you need that else. Leave it off and Ascent flags the gap on the spot, with Run greyed out until you close it:
Add an else arm above so the match handles the values you didn’t name, and it’ll run. You can’t forget a case here — the compiler won’t let you.
These patterns are shallow for now: plain literals and else, nothing more. Matching over your own types, with fields pulled out of each case, comes once you’ve built some types of your own.