• So there's a return branch on every possible path through the code. And that's valuable, it's something you want to think about as your right your own.

    所以代码中每条可能的路径,都会有一个返回值分支,这是非常有价值的,当你自己写程序的时候也应该考虑这件事。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • OK. Note, by the way, if I chase through each possible path, like there's some IFs in here, if there's some places to go, at least in this piece of code, every possible path through this code ends in a return. And that's a good programming discipline, to make sure that happens.

    注意一下,如果我跟进每一条可能的路径,像是这里的,起码在这段代码中就有很多走向,这段代码中的每一条可能路径,在结尾都会返回一个值,这就是一条很好的编程定律,请确保这样做。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • If it isn't, then I'm going to go back around the loop, and notice what happens. If I get all the way around the loop, that is, all the way through that FOR loop and I never find a path that takes me through here, then the last thing I'm going to do is return a pair or a tuple with a special simple number none twice.

    如果没有,我会回到循环看看发生了什么,如果我运行了整个循环,也就是整个for循环,我仍没有找到符合条件的路径,那么我最后做的事情就是返回一对,或者一个数组的两次none值。

    麻省理工公开课 - 计算机科学及编程导论课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定