A game that allows players to play with software development is an excellent method of teaching programming concepts and coding like loops and conditional statements. Zachtronics Shenzhen I/O is a game that accomplishes this. It puts players in the shoes of unhappy engineers working for a dull firm and have to create computer chips by hand. They are given increasingly complex circuits to create, starting by making lights flash in a specific pattern.
The interface of the game is very similar to that is found in browsers, and it also teaches scripting. Screeps is a great example, which combines JavaScript code with massively multi-player online gaming to build self sustaining colonies. Both games excel at teaching basic concepts and gradually introducing other players.