I also never said you couldn't text yourself programming by going to the library, but most of the people who would go to the library to learn coding don't have home computers themselves, I'd wager, and need to use online IDEs which would mean having access to the internet with more up to date resources typically than what's available on the shelves.
In another comment on this topic I brought up that I personally use a blended approach of books for the why's and online for the how's. There's a ton of great coding books out there. Many unfortunately don't make it into library collections and the ones that do typically require either ordering via a hold or just buying outright beggar the library doesn't have it. I'm a huge library lover, you won't find me cheering for their demise.