checking if 2 out of 4 is true no matter which one

Let’s say that I have a switch statement like so

	case 1:
	case 2:
	case 3:
    case 4:

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)


Pseudo code

private bool[] bools = new bool[4];
private int count = 0;

foreach(bool myBool in bools){
if (count>=2){
    return true;
} else {
    return false;

Hi Jan,

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