switch(id){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
How can I detect in an easy manner without overloading my script with tons of code wether 2 out of these 4 are true, may it be 1 and 2 or 2 and 3 or 4 and 1, whenever 2 are true I need something to happen how can I achieve very easily and cleanly?
(I know how to do it but I want a nice and clean way if possible)
I think the problem here is you want something that switch cannot provide.
Basically switch is shorthand for an if-elseif block of code, thus your id variable can only be equal to a single case at any run through.
Without much more info, I can only give you a possible solution that may work.
int trueCounter;
if(id == case1) trueCounter++;
if(id == case2) trueCounter++;
if(id == case3) trueCounter++;
if(id == case4) trueCounter++;
if(trueCounter == 2)
{
// your stuff happens here
}