Enums - probably an old subject

Steve Teale steve.teale at britseyeview.com
Wed Nov 20 23:22:38 PST 2013


import std.stdio;

enum Intention
{
    EVIL,
    NEUTRAL,
    GOOD,
    SAINTLY
}

void foo(Intention rth)
{
    if (rth == EVIL)
       writeln("Road to hell");
}


void main()
{
    foo(EVIL);
}


Why does the compiler complain in both places about EVIL. Can it 
not work out which EVIL I mean? There's only one choice.


More information about the Digitalmars-d mailing list