The source neutral wire on the receptacle is removed and spliced to the white running to the switch, and to a pigtail back to the receptacle neutral. At the switch, the neutral wire is needed to power some dimmer switches and is now required in most switch boxes.
This wiring illustrates the switched-receptacle circuit with the switch coming first. The hot source is wired to the bottom terminal on the switch and the top terminal connects to the black running to the receptacle. The source neutral is spliced through to the receptacle neutral.
The white wire on the switch loop is used to carry current from the source to the switch and it is marked with black tape or paint to label it as hot. The black on the switch loop runs from the top switch terminal to the top half of the receptacle. With this arrangement the top half of the duplex is controlled with the switch and the bottom half is always hot.
Here a 2-way push-button switch is wired to a lamp with 2 bulbs. This diagram can be used to rewire an old push-button lamp with a new switch replacement. The hot wire from the cord is connected directly to the black wire on the switch and the neutral is spliced to the neutral contact on each bulb sockets. The red and blue wires from the switch are each connected to the hot contact on one of the bulb sockets.