﻿# V8026\. The counter is not used inside the body of the nested loop\.

The analyzer has detected a potential error of not using the loop counter in one of the loops when writing nested for loops\.

The example:

```cpp
func BubbleSort(values []int) {
  for i := 0; i < len(values); i++ {
    for j := 0; j < len(values) - 1; j++ {
      if values[i] > values[i + 1] {
        values[i], values[i + 1] = values[i + 1], values[i]
      }
    }
  }
}
```

An error occurred when implementing the bubble sort algorithm: the `j` counter is not used within the loop\.

The fixed code:

```cpp
func BubbleSort(values []int) {
  for i := 0; i < len(values); i++ {
    for j := 0; j < len(values) - 1; j++ {
      if values[i] > values[j + 1] {
        values[i], values[j + 1] = values[j + 1], values[i]
      }
    }
  }
}
```