A P-N junction diode is a semiconductor device formed by joining P-type and N-type materials.
It allows current to flow easily when forward biased (P-side connected to positive terminal and N-side to negative), but blocks current when reverse biased.
This unidirectional conduction property makes the diode useful as a rectifier, which converts alternating current (AC) into direct current (DC) by allowing only one half of the AC waveform to pass through.
Thus, a P-N junction diode acts as an electrical one-way valve.