How do I connect the two cables entering a switch box for a light?
Short answer:  in the switch box, the blacks go to the switch terminals (not the green one - that's for the bare ground) and the whites are spliced together with a wire nut or other connector.