What is a logic gate?

A logic gate is a basic electronic component used in digital circuits that performs a specific logical operation on one or more binary inputs to produce a binary output. The most common logic gates include AND, OR, NOT, NAND, NOR, XOR, and XNOR. These gates operate on binary values, where the inputs are either 0 (false) or 1 (true). The output depends on the type of gate. For example, an AND gate outputs 1 only when both inputs are 1, while an OR gate outputs 1 if at least one input is 1.