2 ms·
How about putting Other at the top? You can convince yourself that the value zero (or one if you like) is reserved for unknown values.
by qbane 2y ago
How about putting Other at the top? You can convince yourself that the value zero (or one if you like) is reserved for unknown values.
- shakna 2y agoThis is what I tend to do. Because 0 is "default", it means "unspecified" in a lot of my API designs.
- Cthulhu_ 2y agoThat's the Go approach, where every value is zeroed so it makes sense for enum values to have a 'none' or 'other' or 'unknown' value as the first value. (note that Go doesn't have enums as a language feature, but you can use its const declaration to create enum-like constants)