live4soccer7
01-05-2011, 07:01 AM
Here is what i'm trying to do and I'm not sure if it will work with a switch, but i'd be better than writing a million if else statements.
var = c
var = z
switch (c)
{
case c > 1 && < 10:
z = 5;
break;
case c > 10 && < 20:
z = 15;
break;
default:
z = 0;
}
I think you see what I'm trying to do. I have a variable 'c' and it is input by the user and I want to make variable 'z' set according to what 'c' is. I know the above code doesn't work, but I'm not sure why. I've tried a million different things to try and get it to work, but it always just goes to default when it displays 'z'. Any help would be great. Thanks.
var = c
var = z
switch (c)
{
case c > 1 && < 10:
z = 5;
break;
case c > 10 && < 20:
z = 15;
break;
default:
z = 0;
}
I think you see what I'm trying to do. I have a variable 'c' and it is input by the user and I want to make variable 'z' set according to what 'c' is. I know the above code doesn't work, but I'm not sure why. I've tried a million different things to try and get it to work, but it always just goes to default when it displays 'z'. Any help would be great. Thanks.