Totally agree with you. Am a staunch defender of alignement myself. Please check out my article on the subject here:

http://francoishill.fr/aligning-patterns-in-code/

You migth be interested to learn that some advocate against (see article).

You might also be interested in reading other articles I have written on code readibility too.

Take care,

Francois ]]>

For example, I got this by simulating 2 hero dice and 5 zombie dice:

Chance of hero winning: 15.75%

Chance of zombie winning: 84.25%

Chance of zombie dying: 17.20%

– Chance of zombie dying in this calculator is wrong. There are 15/216 combinations for this (6.94%)

– Chance of hero winning in this calculator incorporates the chance of the zombie dying. The actual chance of the hero winning absent zombie death is 110/216 (50.93%).

– Perhaps clarify that different in the calculations somehow? “Chance of hero winning. Chance of hero winning by zombie dying. Chance of hero winning by fending off. Chance of zombie winning” (where the first % of the hero’s chance to win is the sum of the two methods by which a hero may win)

]]>I think the “let it run” approach is far harder to read and maintain. As you observe, it gets particularly complex when used to leave a block several levels deep.

I’d add a related rule, which is “exit from a loop as soon as you can”. As long as you only exit forwards (no backwards GOTOs), this is similarly clean.

]]>