Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于重构 #16

Open
geqianqian-shihan opened this issue Oct 24, 2019 · 1 comment
Open

关于重构 #16

geqianqian-shihan opened this issue Oct 24, 2019 · 1 comment

Comments

@geqianqian-shihan
Copy link
Owner

卫语句

//  普通格式
      if (true){
            if (true){
                if (true){
                    for (){
                        if (true){
                            业务代码
                        }
                    }
                }
            }
        }

// 卫语句
        if (false){

        }
        if (false){

        }
        if (false){

        }
        for (){
            if (false){
                continue;
            }
            业务代码
        }

这是其中一类,可以将失败前置。只要有一个条件不通过,就快速返回失败,如果到了最后一行,说明所有判断都通过,剩下的就是你预期的结果。而不是一直查成功。

@geqianqian-shihan
Copy link
Owner Author

重构

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant