T
Tim Golden
Steven said:I've often wished there was too, for the sake of completeness and
aesthetics, I'd love to be able to write:
a xor b
instead of defining a function xor(a, b).
Unfortunately, outside of boolean algebra and simulating electrical
circuits, I can't think of any use-cases for an xor operator. Do you have
any?
I was pondering on this yesterday, and the only case I've
come across in my code -- and it's reasonably common --
is checking that one and only one of two params has been
passed. I have code which wants, say, an id or a name
but doesn't want both. It's hardly difficult to write the
check even now, but an built-in xor would make it fractionally
cleaner.
TJG