• OK, so far though, I've just shown you what happens inside a peace a code. It raises an exception. It goes to that accept clause. We don't have to use it just inside of one place.

    好了,我已经给你们看了,代码内部发生了什么,它报了一个异常,然后就到了处理的片段,我们不该就在一个地方用它。

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

  • What does that say? It says if in the code up here I get an exception of that sort, I'm going to go to this place to handle it.

    这意味着如果在代码中,我得到一个这样的异常,我能到这里来处理它。

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

  • So, summarizing better, assert is something you put in to say to the user, make sure you're giving me input of this type, but I'm going to guarantee you the rest of the code works correctly. Exceptions and exception handlers are saying, here are the odd cases that I might see and here's what I'd like to do in those cases in order to try and be able to deal with them.

    所以更好的总结下,断言就是你放在那里告诉用户,保证你输入的是这种类型的,但我能保证剩下的代码运行正确,异常和异常处理做的事,这里有些我能预期的异常情况,并且这里有些情况,我能尝试处理。

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

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

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

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