A game that lets players experience software development can be an excellent way to teach coding https://mrworkspace.nl/2012/09/22/finding-the-best-news-from-software-development-world/ concepts and programming like loops and conditional statement. Games that accomplish this include Zachtronics Shenzhen I/O which puts players in the shoes of disaffected engineers who work at an ordinary chip manufacturer and must design computer chips by hand. The circuits they have to design get more difficult, starting with making the lights flash in a specific pattern.
The interface of the game looks very similar to the developer tools found in browsers and also teaches scripting. Screeps is a great example, which incorporates JavaScript code with massively multi-player online gameplay in order to create self sustaining colonies. Both games do a fantastic job of teaching fundamental concepts while slowly introduction of new ones.