Sjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 8 days agoCompareBooleanssh.itjust.worksimagemessage-square96fedilinkarrow-up1512arrow-down19
arrow-up1503arrow-down1imageCompareBooleanssh.itjust.worksSjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 8 days agomessage-square96fedilink
minus-squareXanvial@lemmy.worldlinkfedilinkEnglisharrow-up9·8 days agoyou can also use XOR operation return (X || Y) && !(X && Y)
minus-squareActers@lemmy.worldlinkfedilinkEnglisharrow-up2·edit-28 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