-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
enum MyEnum {
Foo
Bar
Baz
}
MyEnum.Foo # => 0
MyEnum.Bar # => 1
MyEnum.Baz # => 2Enums can also have static methods
enum MyEnum {
Foo
Bar
Baz
func is_foo(value) {
value == @Foo
}
}The values of an enum are Numeric values starting at 0, incrementing with each value added to the enum. The enum is represented as an object.
The above code is equivalent to the following object literal:
let MyEnum = {
const Foo = 0
const Bar = 1
const Baz = 2
func is_foo(value) {
value == @Foo
}
}Reactions are currently unavailable