I have a switch statement that is based off an int comparison, but for some reason, it keeps failing on true comparisons, and skipping to the default. Here's my code:
string Error(int errorNum, int send=1, int crash=1)
{
string errorType;
switch(errorNum)
{
case 10:
errorType = "Port number";
...
default:
errorType = "Unknown";
}
...
}
I keep calling it with the argument of 10
, but when I do, it fails. The equivelant if... else if... else
method works, and here it is as well:
string Error(int errorNum, int send=1, int crash=1)
{
string errorType;
if (errorNum == 10) // Normally I'd use braces,
errorType = "Port number"; // but here, it just clutters
...
else
errorType = "Unknown";
...
}