A game that lets players experience software development can be an excellent method of teaching programming concepts and concepts in coding like loops and conditional statement. Games that accomplish this include Zachtronics Shenzhen I/O which puts players in the shoes of dissatisfied engineers who work for an ordinary chip manufacturer and have to build computer chips by hand. They are presented with increasingly difficult circuits to design, starting with making lights blink in a certain pattern.
The interface in the game appears very similar to tools for developers found in browsers and also teaches scripting. Screeps is another great example, which combines JavaScript code with massively multiplayer online gaming in order to create self sustaining colonies. Both games do a fantastic job of teaching the basics as well as slowly introducing new ones.