Well, the user, I don't know in advance what the user is going to type in, right?
我不能预先知道,用户将要输入神秘,对不?
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.
所以更好的总结下,断言就是你放在那里告诉用户,保证你输入的是这种类型的,但我能保证剩下的代码运行正确,异常和异常处理做的事,这里有些我能预期的异常情况,并且这里有些情况,我能尝试处理。
So if I type "man sleep," this is going to give me the user's manual for a program called sleep, but there's a gotcha and the problem set it makes clear, sleep notice that it says at top left sleep one.
所以如果我键入“man,sleep“,它将,给我一个叫做sleep程序的用户手册,但是这里有个参考信息,它使问题更清晰,请注意它指明在左上角。
If you instead use GetString, same thing: blinking cursor, the function is just going to wait for the user to type a word, a sentence or whatever, and then hit Enter.
如果你用GetSring来代替它,同样的:闪烁光标,那个函数只是等待用户来,输入一个单词,一个句子什么的,然后敲回车。
Well, we certainly didn't know on day one how many times each of you was going to want to call get string, how many words a user might type when you call get string.
好的,当然我们不知道第一天你们,想要调用GetSting多少次,当你调用GetSting时,用户会输入多少单词。
应用推荐