Compile time error with this switch statement
<p>I'm getting a compile time error</p>

<p>'UserQuery.ReturnInt(UserQuery.Foo)': not all code paths return a value</p>

<p>Unless I'm not seeing something in the code, the switch statement should return 0 as the default value so all code paths <em>do</em> return a value.</p>

<pre><code>enum Foo
{
    Bar,
    Zoo,
    Boo
}

void Main()
{
    Foo test = Foo.Bar;

    Console.WriteLine (ReturnInt(test));
}

int ReturnInt(Foo test) {

    int someOtherValue = 4; // &lt;---Value may change depending on X

    switch (test)
    {
        case Foo.Bar:
            if (someOtherValue &gt; 20)
                return 1;
            break;

        case Foo.Zoo:
            if (someOtherValue == 5)
                return 4;
            break;

        case Foo.Boo:
            if (someOtherValue == 2)
                return 7;
            break;

        default:
            return 0;
    }
}
</code></pre>
