The AND logic gate takes two bits as an input. Its output follows the rule: "only if both bits are $1$, output $1$; otherwise, output $0$." This gate acts exactly as the "and" operator in programming does: given the Boolean variables $x$ and $y$, the symbol: $x \&\& y$ (
$x \&\& y$), $x \land y$, $x \cdot y$, or $xy$ means "$x$ and $y$". You may also use the bitwise $\&$ operator: $x \& y$.
Below is the AND gate diagram and truth table.
AND Gate diagram. Miriam Briskman, CC BY-NC 4.0.
| Input | Output | |
|---|---|---|
| $x$ | $y$ | $xy$ |
| $0$ | $0$ | $0$ |
| $0$ | $1$ | $0$ |
| $1$ | $0$ | $0$ |
| $1$ | $1$ | $1$ |