I've been a systems programmer, software development director at a well-known retailer, consultant, and (mostly) an entrepreneur who started four companies.
I still LOVE to code. Nothing like the satisfaction, though I enjoyed all the other things I did too.
Ageism is real in our industry. Note the comments below from 30-somethings who are worried their careers are over! Honestly, I'm pretty up-to-date with skills and knowledge. Plus I have so much experience, I know what works and what doesn't work, in the meta sense (architectures, organizations, etc.).
I recently even took on a side gig with a start-up. At our ages, you have to know someone who knows you and knows you'll be good. The good news is that, at our age, we know lots of people.