To make a switch loop, connect the incoming hot (black) wire to the white neutral wire that runs to the switch. Mark the white wire at each end with black tape or black paint to indicate it is hot. Now the incoming white neutral wire is attached to the light fixture, as usual, and the black wire from the switch is connected to the light fixture. In this way, the hot wire initially bypasses the fixture, then loops through the switch and back to the fixture.
http://www.improvenet.com/a/what-is-a-switch-loop-and-how-does-it-work?