3 ms·
> If its never, then it is probably pointless. I disagree, because using an enum value as an index into an array or map (e.g. the scheduler-class example, or a
by notacoward 5y ago
> If its never, then it is probably pointless.
I disagree, because using an enum value as an index into an array or map (e.g. the scheduler-class example, or any other kind of grouping/routing) can still be useful even when there's no if/switch in sight. These patterns occur very frequently IMX. In many of these cases proper subranges would be even better and I wish more languages supported those, but an enum is still better than resorting to naked integers or (ick) strings to represent a small set of discrete values.