Enumerations: Difference between revisions

Line 276:
| value_b
| value_c</lang>
 
To do it with explicit values, I would simply define some constants, probably with '''#define''' (so I could use them in static expressions, etc.):
<lang ATS>#define value_a 1
#define value_b 2
#define value_c 3</lang>
 
You could still restrict things so no other values were possible:
 
<lang ATS>typedef my_enum = [i : int | value_a <= i; i <= value_c] int i</lang>
 
The type of a '''my_enum''' value would be enforced ''at compile time''.
 
=={{header|AutoHotkey}}==
1,448

edits