Enumerations
Spice supports simple enumerations. These constructs are syntactic sugar over int
constants.
Usage¶
Enumerations in Spice work like this:
Spice | |
---|---|
They can be defined only in the global scope. Spice will assign the unsigned integer values 0 to 3 to the items automatically.
Enum items can have values assigned to them. Here is an example:
Spice will then assign 0 for TOMATO
and 1 for POTATO
.