Sjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 24 days agoCompareBooleanssh.itjust.worksimagemessage-square32fedilinkarrow-up1118arrow-down12
arrow-up1116arrow-down1imageCompareBooleanssh.itjust.worksSjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 24 days agomessage-square32fedilink
minus-squareXanvial@lemmy.worldlinkfedilinkEnglisharrow-up0·24 days agoyou can also use XOR operation return (X || Y) && !(X && Y)
minus-squareActers@lemmy.worldlinkfedilinkEnglisharrow-up0·edit-223 days 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