Sjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 1 day agoCompareBooleanssh.itjust.worksimagemessage-square62fedilinkarrow-up1433
arrow-up1433imageCompareBooleanssh.itjust.worksSjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 1 day agomessage-square62fedilink
minus-squareXanvial@lemmy.worldlinkfedilinkEnglisharrow-up7·21 hours agoyou can also use XOR operation return (X || Y) && !(X && Y)
minus-squareActers@lemmy.worldlinkfedilinkEnglisharrow-up2·edit-217 hours 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