CompareTo( ) method

Compares the enum instance to another specified enum instance based on their underlying numeric values. The method returns -1, 0, or 1 depending on whether the numerical value of the enum instance is less than, equal to, or greater than the specified enum instance, respectively. If the specified enum instance is not initialized, the method returns the Unknown value (?).

Return type: INTEGER

Access: PUBLIC

Applies to: Progress.Lang.Enum class

Syntax

CompareTo ( INPUT otherEnum AS Progress.Lang.Enum )
otherEnum
A reference to a Progress.Lang.Enum instance. The enum type of this instance must be the same as the enum type of the instance the method is invoked on.

The following example compares two enum instances of type Days:

ENUM Days:
     DEFINE ENUM Monday
                 Tuesday
                 Wednesday
                 Thursday
                 Friday
                 Saturday
                 Sunday.
END ENUM.
DEFINE VARIABLE myDeliveryDay AS Days NO-UNDO.

myDeliveryDay = Days:Sunday.

IF myDeliveryDay:CompareTo(Days:Friday) = 1 THEN 
  MESSAGE "That is not a valid delivery day.".

Notes

See also

ENUM statement