Skip to main content

CRR0004 - Ternary expression has identical branches

This analyzer detects ternary expressions that always return the same value. Check the following example.

var result = condition ? a + b : b + a; // CRR0004

These expressions are redundant because the condition value never changes the resulting value. You can modify one of the branches or change the ternary expression to a simple assignment.