Anonymous user
Enumerations: Difference between revisions
→{{header|Ada}}: Improved
(revert de-indenting of CL and Scheme under Lisp, and removal of Scheme value-definitions (because values are called for in the task description); kept predicate example) |
(→{{header|Ada}}: Improved) |
||
Line 3:
Create an enumeration of types with and without values.
=={{header|Ada}}==
Ada enumeration types have three distinct attributes, the enumeration literal, the enumeration position, and the representation value. The position value (starting with 0) is implied from the order of specification of the enumeration literals in the type declaration
type Fruit is (apple, banana, cherry); -- No specification of the representation value;
for Fruit use (apple => 1, banana => 2, cherry =>
Ada enumeration types are non-numeric discrete types. They can be used to index arrays, but there are no arithmetic operators for enumeration types; instead, there are predecessor and successor operations. Characters are implemented as an enumeration type in Ada.
=={{header|BASIC}}==
|