Enum
Enum is a type that has a fixed set of values. It is useful to represent a set of related constants.
TODO: Explain in some language it is only integer while in some language it can be string and include user defined fields.
- Java
- Dart
- Go
public enum Color {
RED, GREEN, BLUE
}
enum Color { red, green, blue }
Go does not have builtin enum.
type Color int
const ( // iota is reset to 0
Red Color = iota // Red == 0
Yellow
Blue
)