Using an enumeration type variable

If the enumeration and the variable have already been defined:

Syntax

varName = labeln;

Use the labels just like any other symbolic constant.
Enumeration type variables must only use the type’s labels or equivalent integer.

Code example

enum color {red, green, blue};
enum color myCar;

myCar = red;
myCar = 3;

if (myCar == 2) {
    // do something
}