﻿# V523\. The 'then' statement is equivalent to the 'else' statement\.

The analyzer has detected that the true and false statements of the if statement completely coincide\. This often indicates a logical error\.

The example:

```cpp
if (X)
  Foo_A();
else
  Foo_A();
```

Whether the `X` condition is false or true, the `Foo_A()` function will be called anyway\.

The fixed code:

```cpp
if (X)
  Foo_A();
else
  Foo_B();
```

The real\-world example of this error:

```cpp
if (!_isVertical)
  Flags |= DT_BOTTOM;
else
  Flags |= DT_BOTTOM;
```

Presence of two empty statements is considered correct and safe\. Such constructions can often be found when using macros\.

The example of safe code:

```cpp
if (exp) {
} else {
}
```

The analyzer also identifies it as suspicious if the `if` statement does not contain the `else` block, and the following code is identical to the conditional statement block, while this code block ends with a `return`, `break`, etc\.

The suspicious code snippet:

```cpp
if (X)
{
  doSomething();
  Foo_A();
  return;
}
doSomething();
Foo_A();
return;
```

Perhaps, the copied code fragment either have not been modified, or redundant code have been added\.