Results 1 to 4 of 4

Thread: Xor

  1. #1
    Join Date
    Jul 2003
    Location
    Australia
    Posts
    217

    Unanswered: Xor

    Does anyone know what is XOR (exclusive OR) for ?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    varA XOR varB = ((varA AND NOT varB ) OR (varB AND NOT varA ))

    i.e.
    is TRUE if only one of the XOR items are TRUE.
    is FALSE if both are TRUE or both are FALSE

    izy

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    a possible access use:
    if userHasSelectedSupplier XOR userHasSelectedCustomer then
    'do something useful
    else
    msgbox "please select supplier OR customer"
    '...etc


    and to complete the definition:
    a XOR b XOR c XOR d XOR ......... XOR n (which might not work in Access (i didn't try))
    is TRUE if an odd number of a,b,c,d ....n are TRUE, else FALSE

    izy

  4. #4
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    izy's got it, though some poeple find the result more understandable in the following format

    Code:
    XOR |True |False
    True |False|True
    False|True |False
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •