Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge: Identify ways to use XOR logical operator
#22
For those of us that prefer using the XOR operator, it comes as a shock when programming in another language that does not support this operator. Assuming that this language does have AND/OR/NOT operators, we can emulate an XOR as follows:
Code:
´The following performs the same as: result = a XOR b
result = (a and not(b)) or (b and not(a))
*****
Reply


Messages In This Thread
To Seph: - by Moneo - 06-21-2003, 07:41 AM
To LooseCaboose: - by Moneo - 06-21-2003, 08:59 AM
To drV: - by Moneo - 06-21-2003, 09:24 AM
Re: To drV: - by DrV - 06-21-2003, 09:39 AM
To Toonski84 - by Moneo - 06-21-2003, 10:03 AM
Re: To drV: - by relsoft - 06-22-2003, 02:20 PM
How to do XOR when your language doesn't have this operator? - by Moneo - 06-22-2003, 10:12 PM
Sample reason for using XOR. - by Moneo - 06-23-2003, 09:33 PM
Update: - by Moneo - 07-03-2003, 11:32 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)