c# - Simpler way to compare pairs of bools? -
let's have next bools:
isa isb isc isexistinga isexistingb isexistingcwhen isa, isb, or isc true, if of true bools' corresponding isexisting bools true, want something. if isa, isb, or isc false, corresponding isexisting bool not matter.
here's came with:
if ((isa || isb || isc) && ((!isa || isexistinga) && (!isb || isexistingb) && (!isc || isexistingc))) { // }
i apparently can't think today , wondering if there simpler ways express this.
wolfram alpha can simplify boolean equations, seek link
however in sentiment don't worry much, it's more of import maintain if statements clean , readable worry compactness or performance.
c# comparison boolean
No comments:
Post a Comment