A game that allows players to experience software development is an excellent way to teach programming and coding concepts like loops and conditional statements. Zachtronics Shenzhen I/O is one game that page accomplishes this. It puts players in the shoes of unhappy engineers working for a non-existent company and must build computer chips manually. They are given increasingly challenging circuits to design, starting by making lights flash in a particular pattern.
The interface of the game is similar to the one you will find in browsers. Additionally, it also teaches scripting. Screeps is a great example, which blends JavaScript code with massively multi-player online gameplay to build self-sustaining colonies. Both games do a fantastic job of teaching basic concepts as well as slowly introducing new ones.