Well, when I think about it, we learn Maths until high school no matter what, but a lot of those math complex concepts have no usage in our daily life, people tend to be bad in maths because of that, because they don't see an objective. From that prospective, learning to code is good, because it requires the application of those math concepts, to output simple things we can't easily do.
But I feel, that is not all there is to it. Thus the apparent question.