Can initialize conditionally

CodeRush shows the Can initialize conditionally code issue if you conditionally assign a value to a variable after that variable was initialized.

Fix

Initialize the variable conditionally.

Purpose

The code issue helps you avoid redundant assignments in you code.

Example

int a = 25;
if (b < c)
    a = 15;

Fix:

int a;
if (b < c)
    a = 15;
else
    a = 25;