Enum – Defining reference values

An enum type is a collection of so called enum items that are all associated
with integral numbers. Accordingly, an enum is internally represented as int.

Example code:

the enum is defined in the node metamodel.

1 enum Resident {VILLAGE = 500, TOWN = 5000, CITY = 50000}

The enum resident is defined. You can use it now as other data types, e.g.

1 rule myRule{
2    def var A:int = Resident::Village;
3    modify {
4       emit("A ="+A+".\n");
5    }
6 }

What will print “A =500.”.
How to use it:

More Examples can be found in these Packages:

Was this article helpful?

Related Articles