How does a p-n junction diode work as a switch?

diode conducts in forward bias.so it is on switch.
in reveres bias it will not conduct.so it is off switch