You can specify an ENUM statement to define and group a set of named integer constants. The named integer constants in an ENUM statement are called enumerators.
If you want to specify an enumerator with a scalar_int_exp, you must also specify a double colon seperator (::).
If you specify a scalar integer constant expression, the value of the enumerator is the result of the scalar integer constant expression.
You can use a scalar logical constant expression only if you compile with -qintlog.
If you do not specify a scalar integer constant expression and the enumerator is first in the enumeration_block, the value of the enumerator is 0.
If you do not specify a scalar integer constant expression and the enumerator is after another enumerator in the enumeration_block, the value is one greater than the value of the preceding enumerator.
You can set the kind type parameter of an enumerator using the -qenum option. If you do not specify -qenum, the default kind for an enumerator is 4.
enum, bind(c)
enumerator :: red =1, blue, black =5
enumerator yellow
enumerator gold, silver, bronze
enumerator :: purple
enumerator :: pink, lavender
endenum
The values of these enumerators are: red = 1, blue = 2, black = 5, yellow = 6 , gold = 7, silver = 8, bronze = 9, purple = 10, pink = 11, lavender = 12.
If you supply an initial value for an enumerator, then a :: is required in the ENUMERATOR statement. The red and black enumerators in the list are initialized with a scalar integer constant expression.