#What's up with enum?

1 messages · Page 1 of 1 (latest)

zinc jewel
#

So i see that you can create an enum in a script by just running

enum {ONE, TWO}

As opposed to making an enum with a name like

enum test {ONE, TWO}

When making one with a name it seems to work like a variable or an object, you can reference they specific enum in code by doing match statements etc. But what about the first one. Where does it go? How do you reference it? Can you have more than one? Why would you even want to do this instead of giving it a name? Like you didn't create a variable or an object it's just...there?

swift carbon
zinc jewel
#

So the enum...is the variable?

swift carbon
zinc jewel
#

What's the point of that? Like an enum is basically just a string or int variable that you can set and reference, but it limits the values the variable can have

swift carbon
steep tusk
coral steppe
#

An enum is more like a constant alias for an int rather than a variable / dictionary.