switch(string)
David Ferenczi
raggae at ferenczi.net
Wed Jun 18 01:24:54 PDT 2008
The following code gives the following compilation error:
Error: case must be a string or an integral constant, not BAR1
Error: case must be a string or an integral constant, not BAR2
--------------------------8<------------------------------------
int main(string[] args)
{
string BAR1 = "bar1";
string BAR2 = "bar2";
string myString = "bar3";
switch (myString)
{
case BAR1:
break;
case BAR2:
break;
defualt:
break;
}
return 0;
}
--------------------------8<------------------------------------
Can somebody explain me why?
Thanks,
David
More information about the Digitalmars-d-learn
mailing list