> That means we can only execute this block on the first iteration of the for loop

Hmm, strange... The question is "Why this belong then to the cycle, and not above it?"
I fixed it just by the way like "minimalistic" surgery, so don't observed the cycle conditions.