Enums

An enum is a special class that represents a group of constants (unchangeable variables). One way to think about enums for users familiar with, for example, Stata, is as of categorical variables – each category that the variable can take must be specified in the enum. In general, enums are well suited for use with values that we know are not going to change.

For example, to define a variable Gender that can take either Male or Female values, we define an enum Gender in the model.enums package:

We can then, for example, specify a variable gender in Person class, which will only ever take one of the values specified in the enum:

For a more detailed tutorial on enums we recommend following W3Schools and Oracle’s tutorial.