I started in the third grade. Most kids have trouble coding until they've developed some form of abstract thinking. The biggest thing is to never force someone to learn to code - that'll take the fun out of it. Teach them when they want to learn, and do it on their terms.