Relays could be used to implement control logic.AND, OR, and NOT gates, as well as flip-flops, can be wired from relays.
Digital logic gate with relay:
For the AND gate in Figure (a), relays A AND B must be energized for a voltage to be at X. Figure (b) shows an OR gate. Here, if either relay A OR B is energized, the output X receives a voltage. Figure (c) shows a relay NOT gate. If relay A is energized,the output is 0 V; if it is NOT energized, the output receives a voltage.
Digital flip flop with relay:
A flip-flop can be made from a relay using a principle called sealing. As seen in Figure (d), once the relay is energized, an electrical path through the contacts takes over the job of providing power to the coil, and the original A voltage can be removed.
(This process is frequently called latching. However, a relay catalog uses the term latching relay to mean a relay that has a built-in mechanical-latching mechanism.) To unseal the relay, the power coming through the contacts must be (temporarily) removed.