How does PN-junction diode acts as a switch?

When the diode is reversed biased (positive charge applied to the N side and the negative charge applied to the P side) no current can flow just like when a switch is off. When the diode is forward biased (positive charge applied to the P side and the negative charge applied to the N side) no current can flow just like when a switch is on. Current can only flow in one direction.