two of three statements to be true (best way to write this code)

 

I am looking if this code this  on mql5

boolean atLeastTwo(boolean a, boolean b, boolean c) {
    if ((a && b) || (b && c) || (a && c)) {
        return true;
    }
    else{
        return false;
    }
}

can be replaced with any of the following codes to avoid lengthy coding


(a?1:0)+(b?1:0)+(c?1:0) >= 2

or be expressed like this

a+b+c >= 2 

or

!!a+!!b+!!c >= 2
 
herrcrowley:

I am looking if this code this  on mql5

can be replaced with any of the following codes to avoid lengthy coding


or be expressed like this

or

return (a || b || c) != (a && b && c);

return (a != b) || (b != c);