Data types: Enumeration type
Represents exact one of values defined in a certain enumeration member.
Operands of this data type are intended to store discrete values defined in a certain Chora enumeration member. Chora compiler ensures, that the operands are never initialized with values belonging to foreign enumeration members.
An enumeration data type must always consist of two identifiers: the name of the unit containing the enumeration member and the name of the enumeration member itself, both separated by :: (double colon). The type is designated to be used in declarations of data members able to store the enumeration values. The literal, in turn, consists of the enumeration data type followed by the name of the respective enumeration item. For example:
// 'timing' can store values from the 'Effects::Timing' enumeration.
// for example, the value 'Bounce_Out'.
var Effects::Timing timing = Effects::Timing.Bounce_Out;
if ( timing != Effects::Timing.Elastic_in )
trace "timing is not 'Elastic_In'";
You can compare two enumeration operands in order to test whether these are equal or not. The following table provides an overview of the possible operations:
Equality test for two enumeration operands.
Inequality test for two enumeration operands.
Chora reacts sensitive when mixing operands of different data types within an operation. To avoid compiler warnings or even errors you can convert between enumeration and integer operands explicitly.