V7017. A loop counter is not used for collection indexing in the inner loop.
The analyzer has detected a possible error in two or more nested for loops, when the counter of one of the loops is not used because of a typo.
The example:
let sum = 0;
for (let i = 0; i < N; i++) {
for (let j = 0; j < M; j++) {
sum += matrix[i][i]; // <=
}
}
In this case, it is intended to process all elements of a matrix and sum up them, but i is used instead of j when indexing the columns.
The fixed code:
let sum = 0;
for (let i = 0; i < N; i++) {
for (let j = 0; j < M; j++) {
sum += matrix[i][j];
}
}