|
|
Subscribe / Log in / New account

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 :)


to post comments

C-Style Logical XOR

Posted Jun 14, 2024 16:48 UTC (Fri) by atnot (subscriber, #124910) [Link]

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.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds