Before beginning any electrical repair, shut off the power. Remove the fuse or trip the breaker for the circuit you will be working on in your service panel. Use a neon tester to be sure the power is off. If there is any doubt, you can remove the main fuse or trip the main breaker. Removing the main fuse or tripping the main breaker will usually shut off the power to the entire house.
Electrical wires are color coded to prevent wiring errors.
White wires almost always connect to other white wires or to chrome terminal screws on switches and receptacles. These wiring devices are plainly labeled to show which color goes into each spring grip hole. Switches are nearly always connected into black wires in cables. The only exception is where a cable is extended, making it necessary for the white wire to play the role of the black wire. When this is necessary, the white wires should be painted black to prevent future wiring errors.