AdaScript also has an enumerated type. An enumerated type is a type with a list of literal names. Variables of the type can only be assigned one of the names in the list.
Enumerated types are naturally incompatible with one another, or any other type. They are not integers or strings and cannot be type cast into integers, strings or other enumerateds..
Ada: AdaScript doesn't (yet) have overloading so the items in the enumerated list cannot be overloaded with items from other enumerated types. That is, the names must be unique.
=> type fruit is (apple, blueberry, cherry);
Enumerated types are ordered and can be compared.
=> ? apple < blueberry
There are two built-in enumerated types:
There are more enumerated types in the built-in packages.
|Back To Top|