The problem is that the relation of the body to the loop specifications is reversed, so the inner loop is most proximate to the body in the first, but most distant from the body in the second.<p>The specification of the inner loop should always be most proximate to the body, not last independent of the location of the body.