|
Hans, At 08:40 AM 3/26/98 -0500, you wrote: >>Hi Mark! How to check if exactly 1 out of n conditions is true? >I can't think of any easy way to do that. With a bit of analysis, it's clear that >A XOR B XOR C works for all cases except where all three operands >are true. Generalizing to more conditions, it appears that stringing >together conditions using XOR gives TRUE if the number of TRUE >conditions is odd, FALSE if an even number. So it looks like some >other technique is needed. I was thinking the same thing. I was thinking through the logic and came to the same conlusion as you did. >Will XOR be added to RPG IV? About half a year ago, I suggested >that it might be. However, when I raised the idea in my group, the >response was why bother, since <> provides equivalent function. >So, one way to answer the question is that the language already >has XOR! Except that from a program maintenance (readability) aspect, "<>" definitely not as clear as XOR. Logically, it is a lot more similar to AND and OR than it is to conditioning operands. Technically, it works. Can you reinstate the vote? Thanks. >But if an explicit XOR is added, it still wouldn't help for >your specific situation. Agreed. -mark +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.