Is going to college purely to learn to code a good idea?

More importantly: would I actually learn to code in a software engineering course?

I'm interested in doing complex mechanics in games. I don't have any coding experience though. It seems most people go to college to build a corporate career and make connections. Would I be wasting my time if I went *just* to learn?

Of course, if the gamedev thing doesn't work out I'm sure a degree would help get a good job. But that's not my primary goal. Also, I am aware that gamedev is a risky and time consuming endeavor. The main point is: would I be better off self-teaching?