Description

Performs a logical exclusion operation on two Boolean expressions, or a bitwise exclusion on two numeric expressions.

Syntax

result = expression1 XOR expression2

The XOR operator syntax has these parts:

Part | Description |

result | Any numeric variable. |

expression1 | Any expression. |

expression2 | Any expression. |

Returns

Number

Remarks

For Boolean comparisons, if one and only one of the expressions evaluates to True, result is True. Otherwise, result is False.

If expression1 is |
And expression2 is |
The result is |

True |
True |
False |

True |
False |
True |

False |
True |
True |

False |
False |
False |

For numeric expressions, the Xor operator performs as a bitwise operator. A bitwise comparison of two expressions using exclusive-or logic to form the result, as shown in the following table:

If bit in expression1 is |
And bit in expression2 is |
The result is |

1 |
1 |
0 |

1 |
0 |
1 |

0 |
1 |
1 |

0 |
0 |
0 |

Restrictions

See also

Examples