Enum (keyword)
From RemObjects Software
enum is used to define an enumerated type.
Enumerated types are used when you want to assign identifiers to numerical values.
Example
type SomeColorEnumeration = enum(Red, Green, Blue);
In classic Pascal and Delphi, enum was not used:
type SomeColorEnumeration = (Red, Green, Blue);
While this still works in Oxygene, the use of the enum keyword gives more consistent code when also using flags.
Below the surface, an enumerated type is actually an integer. When using the above examples, the compiler will automatically assign numbers to the values. (starting with 0) This implies that you can easily cast from and to an integer.
It is also possible to override the default numerical values:
type SomeColorEnumeration = enum(Red = 10, Green = 20, Blue = 30);
See Also
Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0
Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)
Glossary — Keywords — Language Features — Platform Features — Samples — Articles — How To — Issues
Categories: Text | Oxygene | Language | Keyword
