Glossary coding Term Page
Enum
A named set of allowed states or constant values
Core Idea
An enum organizes possible states or branches as named constants. Instead of scattering raw numbers through the code, you attach meaning with names such as STATUS_OK, Warning, or Success.
The core benefit is constraint: an enum narrows the valid cases your code should handle. That becomes more valuable as conditionals grow. If a struct groups data fields, an enum often explains what state that data is currently in.
Why It Matters Here
Mathbong uses enums as a bridge between C status codes and Rust pattern-matching habits. Replacing anonymous numbers with named states is one of the fastest ways to make beginner code easier to read.