Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SWITCH command question
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01380575
Message ID:
01380579
Views:
45
>In C#, How do you do something like:
>
>
>public int GetTax(double dAmount)
>{
>    int iRetVal = 0;
>
>    switch (dAmount)
>    { 
>        case < 10:
>            iRetVal = .05;
>            break;
>    }
>
>    return iRetVal;
>}
>
>
>The less than sign doesn't compile

Unless you specify all the other values below (ie case 0: case 1: ..) you cannot

Better use
if( dAmount < 10.0 )
{
}
else if( )
{
}
else
{
}
update : you cannot use a switch with a double
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform