It only allows the current to go in one direction!
There are three parts to a transistor, the base, collector, and emitter. The collector is the electrical supply to be switched on & off. When switched on the emitter is the supply output. The base is the switch. When 5 volts (typically) are applied at the base, the transistor is in the switched on state and flow begins. When the voltage drops flow stops.
Transistors can also be use as amplifiers. In this case varying the voltage at the base varies the amount of flow from the collector to the emitter.
Transistors can also be use as amplifiers. In this case varying the voltage at the base varies the amount of flow from the collector to the emitter.
Well transistor work in three different states, and they are, cut off , saturation and active. In active state transistor works as an amplifier while as a switch transistor work in cutoff (open switch) and saturation states (close switch). This is achieved by the DC biasing.