How to mimic logical XOR in ZX Spectrum basic?

DEF FN x(a,b)=((NOT a) <> (NOT b))

Using NOT as coercion to a boolean value.

EDIT Previously had each side with NOT NOT which is unnecessary for establishing difference between the two, as one will still coerce!

EDIT 2 Added parens to sort out precedence issue.


The logical xor is semantically equivalent to not equal.

IF (left operand) <> (right operand) THEN

should work.

Edit: In the case of integer operands you can use

IF ((left operand) <> 0) <> ((right operand) <> 0) THEN