A game that lets players to experience the process of software development is an excellent method to teach programming concepts and coding, such as loops and conditional statements. Zachtronics Shenzhen I/O is one game that does this. It puts players in the shoes disgruntled engineers who work for a boring firm and have to create computer chips manually. The circuits they are asked to design see post are more complex beginning with making the lights flash in a particular pattern.
The interface in the game appears very similar to tools for developers found in browsers and teaches scripting. Another great example is Screeps, which is a game that combines JavaScript programming and massively multiplayer online gaming to create self-sustaining colonies. Both games do a great job of teaching the basics while slowly introducing new ones.