Declare an enumeration, a module containing a list of named constants as labels.
Syntax
.enum name label [= expression], label [= expression], ... label [= expression]
WarningYou can manually assign two labels with the same value. This is intended behaviour.
Examples
Defines an enumeration for the days of the week.
.enum Days
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
/*
This creates the following labels:
Days.Sunday = 0
Days.Monday = 1
Days.Tuesday = 2
...
Days.Saturday = 6
*/
Initialisers can be used to manually control enumeration values.
.enum Numbers
Eleven = 11,
Twelve,
Thirteen,
Twenty = 20,
Vingt = 20,
Zwanzig = 20,
TwentyOne,
Four = 4,
Five
.echoln Numbers.Eleven ; 11
.echoln Numbers.Twelve ; 12
.echoln Numbers.Thirteen ; 13
.echoln Numbers.Twenty ; 20
.echoln Numbers.Vingt ; 20
.echoln Numbers.Zwanzig ; 20
.echoln Numbers.TwentyOne ; 21
.echoln Numbers.Four ; 4
.echoln Numbers.Five ; 5
You can manually assign two labels with the same value. This is intended behaviour.