See also <https://github.com/nim-lang/Nim/pull/23585>
* values order is not required * automatic numbering is incremental and is reset each time an item with a value is encountered * enum aliases are not supported; for a field definition with numbering, if it's a duplicate, an error will be raises; otherwise the counter will increase until it's not a duplicate anymore block: # unordered enum block: type unordered_enum = enum a = 1 b = 0 doAssert (ord(a), ord(b)) == (1, 0) block: type unordered_enum = enum a = 1 b = 0 c doAssert (ord(a), ord(b), ord(c)) == (1, 0, 2) block: type unordered_enum = enum a = 100 b c = 50 d doAssert (ord(a), ord(b), ord(c), ord(d)) == (100, 101, 50, 51) block: type unordered_enum = enum a = 7 b = 6 c = 5 d doAssert (ord(a), ord(b), ord(c), ord(d)) == (7, 6, 5, 8) Run While this case gives an error type unordered_enum = enum a = 1 b = 0 c d = 2 Run