for (int i = 0; i < orders.Count; i++)
{
Ship(orders[i]);
}Deterministic loop parse: flags zero-based `for` loops bounded by `.Length` or `.Count` and incremented by one, when the body uses the index only inside `[i]` subscripts.
`for (int i = 0; i < items.Length; i++)` where `i` is only used to read `items[i]`. A `foreach` with extra plumbing.
Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.
for (int i = 0; i < orders.Count; i++)
{
Ship(orders[i]);
}Deterministic loop parse: flags zero-based `for` loops bounded by `.Length` or `.Count` and incremented by one, when the body uses the index only inside `[i]` subscripts.
foreach (var order in orders)
{
Ship(order);
}Use `foreach (var item in items)`. Keep the index loop when the position itself matters.
Agents default to the index-loop shape common across C-family languages, even when no index is needed.
ai-slop/csharp-index-loop
ai-slop
Deterministic loop parse: flags zero-based `for` loops bounded by `.Length` or `.Count` and incremented by one, when the body uses the index only inside `[i]` subscripts.
Loops that use the index for anything else (arithmetic, output, passing it on), loops with other bounds or steps, and `foreach` loops are not flagged.
Part of aislop's C# rule set. First-class C# support, including C#-specific AI-slop rules, arrived in aislop v0.14.1.