WeCodeAcademy

XOR and Combining Conditions

AND needs every condition true; OR needs at least one. XOR is true when an odd number of its conditions are true: with two conditions, exactly one of them. It answers "one or the other, but not both".

Example: a free delivery rule that applies to members or orders over 100, but a member whose order is over 100 gets a different offer instead. XOR picks out the first case only.

Exampleexcel
Open in editor »
Quick check

XOR(TRUE, TRUE) is...

Your turn: write the code

In C2:C4 show TRUE only when exactly one of A or B is TRUE (XOR).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.