A game that allows players to experience the process of software development is a great method to teach coding and programming concepts like loops and conditional statements. Games that do this include Zachtronics Shenzhen I/O which puts players in the shoes of dissatisfied engineers working at an uninteresting chip company and have to build computer chips by hand. The circuits they’re required to design are more complex beginning with making lights blink in a specific pattern.
The game’s interface is very similar to that is found in browsers, and it also teaches scripting. Another excellent example is Screeps, which incorporates JavaScript programming with massively multiplayer online gameplay to build self-sustaining colonies. Both games do a wonderful job of teaching basic concepts while gradually introduction of new ones.