# Choose beetween "&&" or "||" via input parameter

I was able to make 2 options..

```
enum cnd{
AND=0,//AND
OR=1, //OR
};

input cnd Condition= AND;//Condition

if(Condition==AND)
{
if(signal1() && signal2()) entry=true;
}
else
{
if(signal1() || signal2()) entry=true;
}
```

i have no idea to make multiple input param

```enum cndb1{
ANDb1=0,//AND
ORb1=1, //OR
};
enum cndb2{
ANDb2=0,//AND
ORb2=1, //OR
};
enum cndb3{
ANDb3=0,//AND
ORb3=1, //OR
};
enum cndb4{
ANDb4=0,//AND
ORb4=1, //OR
};

input cndb1    Conditionb1= ANDb1;//Condition

input cndb2    Conditionb2= ANDb2;//Condition

input cndb3    Conditionb3= ANDb3;//Condition

input cndb4    Conditionb4= ANDb4;//Condition

//am totally lost here!!

if(Conditionb1==ANDb1)
{
if( signal1() && signal2() && signal3() && signal4() ) entry=true;
}
else
{
if(signal1() || signal2() || signal) entry=true;
}
```

is there any possible way to make an operand as input.. ?

```enum ECond {
ECnd_AND=0, //AND
ECnd_OR,    //OR
};

input ECond Conditionb1= ECnd_AND;//Condition

input ECond Conditionb2= ECnd_AND;//Condition

input ECond Conditionb3= ECnd_AND;//Condition

input ECond Conditionb4= ECnd_AND;//Condition

bool Combine(ECond cond,bool A,bool B)
{
if(cond==ECnd_AND) return A&&B;
return A||B;
}

bool CheckSignals()
{
bool entry = Combine(Conditionb1,signal1(),signal2());
entry = Combine(Conditionb2,entry,signal3());
entry = Combine(Conditionb3,entry,signal4());
entry = Combine(Conditionb4,entry,signal5());
return entry;
}```

lippmaje #:

Amazing .. Thanks bro!! i really appreciate your effort!!

```enum ECond {
ECnd_AND=0, //AND
ECnd_OR,    //OR
};

input ECond Conditionb1= ECnd_AND;//Condition

input ECond Conditionb2= ECnd_AND;//Condition

input ECond Conditionb3= ECnd_AND;//Condition

input ECond Conditionb4= ECnd_AND;//Condition

bool Combine(ECond cond,bool A,bool B)
{
if(cond==ECnd_AND) return A&&B;
return A||B;
}

bool CheckSignals()
{
bool entry = Combine(Conditionb1,signal1(),signal2());
entry = Combine(Conditionb2,entry,signal3());
entry = Combine(Conditionb3,entry,signal4());
entry = Combine(Conditionb4,entry,EMPTY_VALUE);
return entry;
}```

i guess once no more conditions!!.. last value should return EMPTY_VALUE!!

It takes 1 condition to combine 2 values, 2 conditions to combine 3 values, and so on. Your example was short of 1 signal and so I added one. Up to you how to fix this.

lippmaje #:
It takes 1 condition to combine 2 values, 2 conditions to combine 3 values, and so on. Your example was short of 1 signal and so I added one. Up to you how to fix this.
Understood.. thanks.💯
I got a new friend..
Reason: