Enums
Enums are collections of identifiers that can be used as types.
Basic Syntax
An enum can be declared using the enum keyword:
enum BreakfastFood:
pancake;
hash_brown;
burger;
By default, an enum identifier will generate as its index.
| SillyScript | JSON |
|---|---|
|
The SillyScript definition call:
|
The equivalent JSON:
|
Underlying Type
An enum can generate as other types. Simple add an -> TYPE after the enum name to dictate what type it’s converted to.
Currently only string and int are supported.
| SillyScript | JSON |
|---|---|
|
The SillyScript definition call:
|
The equivalent JSON:
|
Argument
An enum’s name can be used as an argument.
| SillyScript | JSON |
|---|---|
|
The SillyScript definition call:
|
The equivalent JSON:
|