﻿# V8004\. The use of 'if A \{\.\.\.\} else if A \{\.\.\.\}' pattern was detected\. A potential logical error is present\.

The analyzer has detected a potential error in a construction consisting of conditional instructions\. The error is caused by repeated if conditions, which may result in the code within that branch becoming unreachable\.

The example:

```cpp
const (
  MONDAY    = "Monday"
  TUESDAY   = "Tuesday"
  WEDNESDAY = "Wednesday"
  THURSDAY  = "Thursday"
  FRIDAY    = "Friday"
)

if day == MONDAY {
  ....
} else if day == TUESDAY {
  ....
} else if day == WEDNESDAY {
  ....
} else if day == THURSDAY {
  ....
} else if day == MONDAY {
  ....
}
```

In the example, there are two `if` constructions with the same condition\. If control flow reaches the second condition, it will always evaluate as `false`, making all code in the corresponding branch unreachable\.

The fixed code:

```cpp
if day == MONDAY {
  ....
} else if day == TUESDAY {
  ....
} else if day == WEDNESDAY {
  ....
} else if day == THURSDAY {

} else if day == FRIDAY {
  ....
}
```