|Just another Perl shrine|
logical Exclusive Or, xorby fruiture (Curate)
|on Oct 14, 2002 at 12:35 UTC||Need Help??|
I have written a lot of code, probably not even a fraction of what experienced programmers have written, but quite a lot for my age i'd say (for I'm student and yet looking forward to studying CS and stuff).
Second, I really like playing around with the logical operators and short-circuit. That sometimes ends up in long but single statements.
As you can guess and see from the example, the code i write is primarily for CGI stuff or short system-administration programs, rather pragmatic and often used only once. But the range of tasks is fairly broad.
But to the point: I have encountered many situations where "logical operator fun" can be used, but i have never used (it was never possible) the logical eclusive or.
Searching on this site gives me nodes that deal with XOR encryption, none deales with the 'xor' Operator.
Now, what i'd be interested in is: In what situations does the 'xor' come into play? I could imagine that scientific algorithms need it, but have you ever needed it in application code? My assumption that it seems to be "unused apart from demonstration of its functionailty" is strengthened by the fact that there seems to be only the bitwise XOR in C, no logical.
I'd really like to see snippets or explanations where the real-life use of Locigal Exclusive Or can be found or if it is just there for completeness.--