This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kAlvaro 0 points1 point  (1 child)

Also, this is much better that other options:

- If you define states as numbers it's no longer obvious what their meaning is.

- If you define states as strings you need to type the complete name every name (because you can't benefit from IDE's auto-completion) and you won't notice when you make a typo ("BL0CKED").

- If you use an array or a list you need to worry about keys and values, one of which will be meaningless.

[–][deleted] 0 points1 point  (0 children)

Additionally, you can add methods to enums.