Current national electrical code in the US (since the 1980s) is a neutral in every switch box. Before then a switch loop was allowed so you see a lot of older construction with those.
You also see newer construction with those where Uncle Dave™ decided it was easier to only have to run a wire down from the light rather than fish it up through the crawlspace, NEC be damned.