Sjmarf to Programming Humor@lemmy.worldEnglish • 1 month agoCompareBooleanssh.itjust.worksimagemessage-square97fedilinkarrow-up1513arrow-down19
arrow-up1504arrow-down1imageCompareBooleanssh.itjust.worksSjmarf to Programming Humor@lemmy.worldEnglish • 1 month agomessage-square97fedilink
minus-square@Xanvial@lemmy.worldlinkfedilinkEnglish9•30 days agoyou can also use XOR operation return (X || Y) && !(X && Y)
minus-square@Acters@lemmy.worldlinkfedilinkEnglish2•edit-229 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