For Enum, it is not documented in the Odin Overview - Enumerations that nil value can be used as zero value of an Enum. So, I thought the integer 0 is the only zero value of Enum because Enum already has a zero value (integer 0), so there is no need for another zero value.
But the examples in Odin Overvew - or_return show that nil can be used to compare a Enum variant with value 0.
So, my questions are:
How does nil value fundamentally work?
Is is just 0 under the hood, i.e., the memory completely zeroed out?
I am not quite sure, but I think nil and 0 are equivalent vor enums. There is also an open issue because of the ambiguity in switch cases.
The documentation/overview needs to be updated to explain and clarify the concept of nil behind enums and the difference to unions where nil means nothing/undefined aka absence of a value.
But the zero value for enums can also either be a real enum case or an invalid one, for example when the first case starts with 1 , or when the enum has no cases at all.