﻿# V1008\. No more than one iteration of the loop will be performed\. Consider inspecting the 'for' operator\.

The analyzer has detected a possible error that has to do with using suspicious initial and final values of the counter variable in a 'for' statement\. This may break the logic of execution\.

Consider the following example of suspicious code:

```cpp
int c = 0;
if (some_condition)
{
  ....
  c = 1;
}
for (int i = 0; i < c; ++i) {
  ....
}
```

The loop will iterate either 0 or 1 time; therefore, it can be replaced with an 'if' statement\.

```cpp
int c = 0;
if (some_condition)
{
  ....
  c = 1;
}
if (c != 0)
{
  ....
}
```

There could also be a mistake in the expression evaluating the value of the variable that the loop counter is compared with\. For example, the programmer could have actually meant the following:

```cpp
int c = 0;
if (some_condition)
{
  ....
  c = 1 + n;
}

for (int i = 0; i < c; ++i)
{
  ....
}
```