#234 – Multiple return Statements

You can have more than one return statement in a method and they can appear anywhere in the method.  If the return type of the method is not void, you must have at least one return statement and all return statements must return a value of the appropriate type.

It’s normally considered good practice to have a single return statement at the end of the method, to make the code more readable.  But you could also do something like the following:

        public float GiveAgeInHumanYears()
        {
            if (Age < 1)
                return 0;
            else if (Age == 1)
                return 10.5f;
            else
                return 21 + ((Age - 2) * 4);
        }