Enumerations: Difference between revisions

Line 155:
banana% = 2
cherry% = 3</lang>
 
==={{header|BaCon}}===
BaCon includes an ENUM statement, with or without fixed values. If no value is given, enumerations start at zero and increase by integer 1.
 
<lang freebasic>' Enumerations
' Start at zero
ENUM
cat, dog, parrot
END ENUM
PRINT "Dogs are #", dog
 
' Set value
ENUM
Sunday=1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
END ENUM
PRINT Sunday, " ", Wednesday, " ", Saturday
 
' Change values, ENUM names must be unique
ENUM
sunday=7, monday=1, tuesday, wednesday, thursday, friday, saturday
END ENUM
PRINT sunday, " ", wednesday, " ", saturday</lang>
 
{{out}}
<pre>prompt$ ./enums
Dogs are #1
1 4 7
7 3 6</pre>
 
=={{header|Bracmat}}==
Anonymous user