!= on Booleans is XOR
On two Boolean values, != is exclusive or: TRUE exactly when they differ. The parser rejects A != B and offers XOR, which is the same function under its logical name.
The diagnostic recorded below: != is not an expression operator; use XOR when the two sides must differ. The two-input XOR table is the “not equal” table: FALSE on the rows where A and B agree, TRUE on the two rows where they differ. In Python, True != False is True; in Java a != b on two boolean values is exclusive or; in JavaScript a !== b on Booleans is the same.
The reason to translate rather than accept the spelling is the chain. a != b != c in Python is a chained comparison, a != b and b != c, while A XOR B XOR C is parity; the two are different functions, and a parser that accepted != as XOR would read Python wrongly. Writing XOR makes the parity reading explicit, and the pitfall page on three-input XOR shows the row on which parity and “exactly one” differ.
The same family of signs, =, == and !=, covers equality, the biconditional and exclusive or, and each has its own pitfall page. The symbols page records all of them with the parser's message.
What the parser says
| You typed | Code | Why it is rejected | Repair offered |
|---|---|---|---|
| A != B | unsupported-operator | `!=` is not an expression operator. Use `XOR` when the two sides must differ. | Replace with XOR |
The common slip
Writing A != B for “A and B are different conditions” in a rule, meaning that both apply but are distinct. The formula says the two values differ at run time, which is exclusive or; the sentence was not about values at all.
Questions
Is A XOR B the same as NOT (A <-> B)?
Yes. Exclusive or is the negation of the biconditional, and XNOR, the biconditional, is the negation of XOR. The equivalence checker proves it on four rows.
What is != on integers?
Ordinary inequality, which has nothing to do with XOR; 3 != 5 is TRUE and 3 ^ 5 is 6. The translation to XOR applies only to two Boolean operands.
Related
Tools
- Logical equivalence checker: two expressions, exact verdict, counterexample
- Truth table generator: any Boolean expression, up to 12 variables, with intermediate columns
See also
- XOR gate: truth table for 2, 3 and 4 inputs (odd parity, not “exactly one”)
- XNOR gate: truth table, symbol and equivalence with the biconditional
- Double equals (==) compares values; for logical equivalence use ↔
- “=” is not a Boolean operator: use ↔ or compare the formulas
- XOR of three inputs is odd parity, not “exactly one”
- Boolean logic in Python: and, or, not, precedence and common mistakes
- Boolean logic in Java: &&, ||, ! vs &, | and ^
Pitfalls
Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.