Enumerations and Associated Values

Patterns can be used with enumerations and their associated values to match specific enumeration cases. The next example shows an enumeration that represents a train’s live status.