让函数容易阅读

  static bool m1(int i)
        {
            if (i > 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

类似上述代码非常不易于阅读 且不易于表意
        static bool m2(int i)
        {
            bool result;
            if (i > 1)
            {
                result = true;
            }
            else
            {
                result = false;
            }

            return result;
        }

尽量不要在函数中间用return语句 返回. 因为这看上去似乎不太美观.
最好按照以下格式书写函数
1.变量定义                //定义函数需要的变量
2.函数运算               //完成函数的功能
3返回运算结果        // 返回函数的结果
原文地址:https://www.cnblogs.com/bestdqf/p/1454112.html