eliminate return function
<p>how can i eliminate multiple number of return statements to one statement. example: i hav one if clause, the result of the if clause is true it will return 0. or return 1, the else of the same if contains another if clause. it has also the return value. how can i eleiminate this four return statement to one?</p>

<p>this is the program</p>

<pre><code>if (IgC == true)
        {
            if (val1.ToUpper() == val2.ToUpper())
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }

        else
        {
            if (val1 == val2)
            {
                return 0;
            }

            else
            {
                return 1;
            }
        }
</code></pre>
