Sjmarf to Programming Humor@lemmy.worldEnglish · 4 months agoCompareBooleansimagemessage-square94fedilinkarrow-up1516arrow-down19
arrow-up1507arrow-down1imageCompareBooleansSjmarf to Programming Humor@lemmy.worldEnglish · 4 months agomessage-square94fedilink
minus-squareXanvial@lemmy.worldlinkfedilinkEnglisharrow-up9·4 months agoyou can also use XOR operation return (X || Y) && !(X && Y)
minus-squareActers@lemmy.worldlinkfedilinkEnglisharrow-up2·edit-24 months agoI was debating on bitwise operations, but decided on super basic if statements which I think the compiler would optimize, happy to see the logical operation form too
you can also use XOR operation
return (X || Y) && !(X && Y)
I was debating on bitwise operations, but decided on super basic if statements which I think the compiler would optimize, happy to see the logical operation form too