For exhaustive enums I need to handle the rest of the values with else whilst I can see _ is also allowed but it's a compile error as in this example:
switch (op) {
1 => {
current_value += 1;
},
2 => {
current_value -= 1;
},
3 => {
current_value *= current_value;
},
_ => unreachable,
}
errors with :
exercises\032_unreachable.zig:28:9: error: '_' prong only allowed when switching on non-exhaustive enums
switch (op) {
^~~~~~
exercises\032_unreachable.zig:38:13: note: '_' prong here
_ => unreachable,
^
exercises\032_unreachable.zig:28:9: note: consider using 'else'
What's a non-exhaustive enum?