Is enum broken ?

i have an error :

    Direction := enum{Up, Down, Left, Right}

“Type definitions are not yet implemented outside of a module scope.”

It needs to be declared outside the class. Put it after your using statements.

2 Likes

You can’t have it outside of a module. Just tab it under the function you want to use Direction with.

1 Like

I get it, i declare a enum type first, and a var in the class. Thx!

Can you show ALL the code for how you do this? Tried this many ways and nothing but errors. Frequent error message is: Not enough macro clauses. It is not clear from the documentation how to set this up. Thank you.

States := enum{Locked, Unlocked, Busy, Available}
machine_device := class(creative_device):
    State : States = States.Locked
1 Like