Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V8029. The outer loop counter is...
menu mobile close menu
Additional information
toggle menu Contents

V8029. The outer loop counter is used in the condition of the inner loop. Perhaps the inner loop counter should be used instead.

Jun 10 2026

The analyzer has detected the use of an outer for loop counter in the condition of an inner loop, which may indicate a logical error.

In a simple form, this error looks as follows:

for i := 0; i < M; i++ {
  for j := 0; i < N; j++ {
    a[i][j] = 0
  }
}

The inner loop compares i < N instead of j < N. The fixed code:

for i := 0; i < M; i++ {
  for j := 0; j < N; j++ {
    a[i][j] = 0
  }
}