I have a boolean logic question. I have the following if statements that should be able to be coalesced into a single boolean expression. Please help. I’ve spent way too much time on this and I’m actually too ashamed to ask my co-workers.
if (denyAll == true & allowOne == false) return false;
if (denyAll == true & allowOne == true) return true;
if (denyAll == false & allowOne == false) return false;
if (denyAll == false & allowOne == true) return true;
return true; //should never get here
I’m sure there is an elegant solution.
Thanks
Would
return allowOne;do the trick?