A diode is a two-terminal electrical component that preferentially conducts current in one direction; it has low resistance in one direction and high resistance in the other direction. Nowadays, the most popular type of diode is a semiconductor diode, which is a crystalline piece of semiconductor material with a p-n junction attached to two electrical terminals. The first semiconductor-based electronic devices were semiconductor diodes.