Tagged Unions and switch
Pattern-match over union variants.
Remembering the Variant
A plain union forgets which field is active. A tagged union pairs the value with an enum tag that records the current variant.
Declaring a Tagged Union
You write union(enum) to let Zig generate a matching tag automatically, one tag name per field.
const Value = union(enum) { int: i64, text: []const u8 };