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

V8030. The outer loop counter is used in the init statement of the inner loop. Perhaps a different variable should be used as a counter instead.

Jun 10 2026

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

In a simple form, this error looks as follows:

var i, j int

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

The fixed code:

var i, j int

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

This diagnostic rule is classified as: