A game that allows players to experience the process of software development is a great method to teach programming and coding concepts such as loops and conditional statements. Zachtronics Shenzhen I/O is one game that accomplishes this. It puts players in the shoes disgruntled engineers who work for a drab company and have to build computer chips manually. The circuits they’re asked to create become more complicated, starting with making the lights flash in a particular pattern.
The game’s interface is very similar to web browser’s developer tools and teaches scripting. Screeps is another excellent example, which blends JavaScript code with massively multiplayer online games to build self-sustaining colonies. Both games do an excellent job of teaching the basics as well as slowly introduce new ones.