Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V7004. The 'then' statement is...
menu mobile close menu
Analyzing projects
Additional information
toggle menu Contents

V7004. The 'then' statement is equivalent to the 'else' statement.

Apr 03 2026

The analyzer has detected a suspicious code fragment where both branches of an if statement are same. This often indicates an error.

The example:

if (cond)
  result = firstFunc(val);
else
  result = firstFunc(val);

Regardless of the value of the cond expression, the same operations are performed. Most likely, such code contains an error.

The fixed code:

if (cond)
  result = firstFunc(val);
else
  result = secondFunc(val);

This diagnostic rule is classified as:

You can look at examples of errors detected by the V7004 diagnostic.