XOR is great for adding things like "include / exclude" to an argument. Here's 
a real world example:

I have a function that strips out non-numeric data from numeric only form 
inputs.

I use it on a bunch of pages. Some of these pages are basically *all* numeric 
data. Some pages only have a little bit of numeric data.

Instead of stripping them out one by one, I just do a call to my function:

stripForm('var1, var2', skip = 1)

then in stripForm, you just do a check:

foreach form element
  if arg1 contains elementName XOR skip
     strip characters

So basically, if skip is set to 1, it only strips characters on things not 
listed in the first argument - that is, it "skips" the ones in the argument. If 
Skip is set to 0, it only strips characters on elements in the first argument.

There are a lot of variations on this, but XOR's power is primarily in 
simplifying a two-pronged test into one statement.


> Maybe for data integrity checks?  A record has to be dated in 2005 or
> 2004, but not both, and not before 2004?  Of course then a data range
> would work just as well...
> 
> That is an odd one, it doesn't seem like it would be used a whole lot.
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> 
> > Sent: Thursday, November 03, 2005 2:46 PM
> > To: CF-Talk
> > Subject: XOR
> > 
> > ColdFusion comparison statements (CFIF, etc.) support the XOR 
> > joiner between clauses. This is used as such:
> > clause1 XOR clause2
> > This says that either clause1 or clause2 has to be true for 
> > the statement to be true. If both are true or both are false, 
> > then the entire statement is false. My question is: can 
> > anyone think of a real world example where you would need a 
> > statement like this?
> 
> 
> [INFO] -- Access Manager:
> This transmission may contain information that is privileged, 
> confidential and/or exempt from disclosure under applicable law.  If 
> you are not the intended recipient, you are hereby notified that any 
> disclosure, copying, distribution, or use of the information contained 
> herein (including any reliance thereon) is STRICTLY PROHIBITED. If you 
> received this transmission in error, please immediately contact the 
> sender and destroy the material in its entirety, whether in electronic 
> or hard copy format.  Thank you.   A2
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262390
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to