| INPUT | OUTPUT | |
| A | B | A B |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
In logic and mathematics, if and only if (sometimes abbreviated as iff) is a logical operator denoting a logical biconditional (often symbolized by or). It is often used to conjoin two statements which are logically equivalent.
In general, given two statement A and B, the statement "A if and only if B" is true precisely when both A and B are true or both A and B are false. In which case, A can be thought of as the logical substitute of B (and vice versa).
An "if and only if" statement is also called a necessary and sufficient condition. For example:
Note that the truth table shown is also equivalent to the XNOR gate.