Sjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 25 days agoCompareBooleanssh.itjust.worksimagemessage-square72fedilinkarrow-up1494
arrow-up1494imageCompareBooleanssh.itjust.worksSjmarf@sh.itjust.works to Programming Humor@lemmy.worldEnglish · 25 days agomessage-square72fedilink
minus-squareXanvial@lemmy.worldlinkfedilinkEnglisharrow-up8·25 days agoyou can also use XOR operation return (X || Y) && !(X && Y)
minus-squareActers@lemmy.worldlinkfedilinkEnglisharrow-up2·edit-225 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