Types & data

match, exhaustively

You’ve met match on scalars and on optionals. Here it does its real job: opening a union, pulling the fields out of each variant, and forcing you to handle every case.

Each arm names a variant and binds its fields — radius in one, width/height in the other — so you’re always working with exactly the data that case carries.

Miss a variant and Ascent won’t let it slide:

“This match doesn’t handle Rect” — flagged on the spot, Run greyed out until you add the arm. For a union you list every variant and skip the catch-all; that way, adding a new variant later makes the compiler come find you.