Paul Johnson wrote: > I think I wrote my first ever goto code in C yesterday.
Way back when I was a teen-geek, I played around writing a few games, mostly in C, with the odd bit of assembler thrown in for bad taste. One of these was a rip-off of the classic Tron light-cycle game. I got myself in an almighty mess trying to write a structured control loop that would handle 2 player input or 1 player and computer. I had to read keyboard scan codes to detect multiple keys being pressed simultaneously. This made it particularly gnarly, although I forget the precise details. Whichever way I carved it up it got ugly. The code resisted all attempts at being structured. After hacking on this same chunk of code for days and getting no further, I suddenly realised that a simple goto made the problem collapse into thin air. I was enlightened. The use of goto is not always considered harmful. A