This cool circuit will sample the input and then transmit it to the output. If you close the switch while the a.c. wave is in the positive swing the output will light the LED. If you open the switch while the a.c. wave is still in the positive swing the LED will stay on (held statically by the capacitor). The output will only turn off the LED until a negative a.c. wave is sampled during a new toggling of the switch