﻿# V517\. Potential logical error\. The 'if \(A\) \{\.\.\.\} else if \(A\) \{\.\.\.\}' pattern was detected\.

The analyzer detected a possible error in a construct consisting of conditional statements\.

Consider the sample:

```cpp
if (a == 1)
  Foo1();
else if (a == 2)
  Foo2();
else if (a == 1)
  Foo3();
```

In this sample, the 'Foo3\(\)' function will never get control\. Most likely, we deal with a logical error and the correct code should look as follows:

```cpp
if (a == 1)
  Foo1();
else if (a == 2)
  Foo2();
else if (a == 3)
  Foo3()
```

In practice, such an error might look in the following way:

```cpp
if (radius < THRESH * 5)
  *yOut = THRESH * 10 / radius;
else if (radius < THRESH * 5)
  *yOut = -3.0f / (THRESH * 5.0f) * (radius - THRESH * 5.0f) + 3.0f;
else
   *yOut = 0.0f;
```

It is difficult to say how a correct comparison condition must look, but the error in this code is evident\.