if conditional 2 out of 3
8 views (last 30 days)
Zeynab Mousavikhamene on 11 May 2020
I have three groups of number which can be 0 or 1. like A, B and C. I want to write a conditional to be true if 2 of three values were 1. How can I do that?
The simplest way would be like:
if (A==1 && B==1) or (A==1 && C==1) or (B==1 && c==1)
but I am searching for sth shorter.