Under Review
over 2 years ago

enum with no integer and no error

enum
{
    __1 = "test",
    __2,
    __3 = 0
}

println in console:

test
0
0

but according to doc https://developer.garmin.com/connect-iq/monkey-c/functions/

Note that assigning anything other than an integer will cause an error.

Parents
  • 1. Or both ;)
    2. enums on string: person, company, government

    en.wikipedia.org/.../Enumerated_type

    When enums are used in XML it is often a string and not just a number/integer. An example in use by Dutch gov:

    	<simpleType name="FunctieVrijBerichtElement">
    		<restriction base="string">
    			<enumeration value="antwoord"/>
    			<enumeration value="entiteit"/>
    			<enumeration value="selectie"/>
    			<enumeration value="update"/>
    			<enumeration value="zaakinfo"/>
    		</restriction>
    	</simpleType>

Comment
  • 1. Or both ;)
    2. enums on string: person, company, government

    en.wikipedia.org/.../Enumerated_type

    When enums are used in XML it is often a string and not just a number/integer. An example in use by Dutch gov:

    	<simpleType name="FunctieVrijBerichtElement">
    		<restriction base="string">
    			<enumeration value="antwoord"/>
    			<enumeration value="entiteit"/>
    			<enumeration value="selectie"/>
    			<enumeration value="update"/>
    			<enumeration value="zaakinfo"/>
    		</restriction>
    	</simpleType>

Children
No Data