C-Style Logical XOR
C-Style Logical XOR
Posted Jun 14, 2024 15:57 UTC (Fri) by magnus (subscriber, #34778)In reply to: C-Style Logical XOR by dskoll
Parent article: perl v5.40.0 released
If you're writing code to draw a chess board and deciding which color to use in each square, logical xor could be handy (row number is even xor column number is even). But thats a bit of a niche case :)
Posted Jun 14, 2024 16:48 UTC (Fri)
by atnot (subscriber, #124910)
[Link]
C-Style Logical XOR
Surely in that case you'd usually rather write something such as `col ^ row & 1`? It's kind of a bit too smart, but not much more than using an xor operator.