A game that lets players to experience software development is an excellent method of teaching programming and coding concepts such as loops and conditional statements. Games that can do this include Zachtronics Shenzhen I/O which puts players in the shoes of dissatisfied engineers working at an uninteresting chip maker and must build computer chips by hand. The circuits they’re asked to create become more complicated beginning with making the lights flash in a certain pattern.
The interface of the game is very similar to that you see in browsers, and it teaches scripting. Another great example is Screeps which blends JavaScript coding with massively multiplayer online gameplay to create self-sustaining colonies. Both games do a wonderful job of teaching fundamental concepts as well as slowly introduce new ones.