Variant
Noun · Development
Definitions
One of the possible values of an enum or algebraic data type. Each variant can optionally carry associated data. Pattern matching exhaustively handles all variants, ensuring no case is forgotten.
In plain English: One specific option in a type that can be several different things — like how a traffic light can be Red, Yellow, or Green, each a different variant.
Example: "Add a Timeout variant to the Error enum so callers can distinguish network failures from logic errors."