A single loop body that mixes filter, map, reduce, and side-effect concerns; the agent verifying any change must trace all concerns through the same iteration.
Each loop does one thing; the agent reasons about one concern per loop and can replace each loop independently with a pipeline.
Before the refactoring
let totalSalary = 0;let youngest = Infinity;for (const p of people) {if (p.age < youngest) youngest = p.age;totalSalary += p.salary;}
After the refactoring
const totalSalary = people.reduce((s, p) => s + p.salary, 0);const youngest = Math.min(...people.map(p => p.age));
The agent's per-line reasoning must account for every concern the loop body addresses; changing one concern risks silent interaction with the others.
Two loops over the same collection cost more per iteration than one; for hot paths the runtime overhead matters and the agent verifying performance must measure.
Each loop body holds one state machine the agent simulates without interleaving; an edit to one job no longer needs the other job's tokens loaded to predict the loop's output.
Splitting loops whose concerns share per-iteration state — accumulator-of-running-difference, look-behind logic — fragments coupled state the agent must now re-derive in each split.