# enum2int

This function converts an enumerated value into an integer value associated to the enumerated value.

Related keyword:

- integer
- enumerated

### enum2int(in Enumerated_type inpar) return integer

- The actual parameter passed to inpar always shall be a typed object.

Example:

type enumerated MyFirstEnumType {
Monday, Tuesday, Wednesday, Thursday, Friday
};
type enumerated MySecondEnumType {
Saturday(-3), Sunday (0), Monday
};
//within a dynamic language element:
var MyFirstEnumType vl_FirstEnum := Monday;
var MySecondEnumType vl_SecondEnum := Monday;
enum2int(vl_FirstEnum) // returns 0
enum2int(vl_SecondEnum) // returns 1
vl_FirstEnum := Wednesday;
vl_SecondEnum := Saturday;
enum2int(vl_FirstEnum) // returns 2
enum2int(vl_SecondEnum) // returns -3
vl_FirstEnum := Friday;
vl_SecondEnum := Sunday;
enum2int(vl_FirstEnum) // returns 4
enum2int(vl_SecondEnum) // returns 0