Enum degraded or spec changed with Build 540?
MQL5 compiler controls type conversion - https://www.mql5.com/en/docs/basis/types/casting
Alternative, you can try this code:
Print(EnumToString(InpDayOfWeek));
- www.mql5.com
MQL5 compiler controls type conversion - https://www.mql5.com/en/docs/basis/types/casting
Alternative, you can try this code:
Enum type can be converted to integer type:
Print(NAME[(int)InpDayOfWeek]);
But imagine that SUNDAY != 0 and MONDAY !=1 ..., and your code will not work.
You can use switch like this:
string DayOfWeekToString(ENUM_DAY_OF_WEEK day) { switch(day) { case SUNDAY: return("Sunday"); case MONDAY: return("Monday"); ... default:return(""); } }
Thanks a lot. It was fixed.
At this moment you better use casting like this
Print(NAME[(int)InpDayOfWeek]);
Error message is:
'InpDayOfWeek' - integer expression expected testEnum2.mq5 24 16
Is enum type integer or not?