It's 71 or whatever so that if condition doesn't apply, but now what do I do in this next line?
它似乎71或者其它的,如果条件不适用,在下一行我做了什么?
and I had to present myself and say what I would do if I were a tour guide.
我必须自我陈述,然后阐述如果我当上了导游我会做什么。
Because if I were to say Torture this one and then he does it, think about what's going to happen.
因为如果我说“折磨这个”然后他真的做了,试想一下会发生什么。
I'm coming at this guy and what I want to do, if I can, I want to kill him.
我面对这个家伙,我该怎么做,如果我可以,我就杀了他
Now let me spend just a second to say, what was this actually doing?
如果我在这里这么做-啊,它返回给我了值?
But, they create a Central Commission of Hygiene and Sobriety which tell people-- encourage people to eat healthfully, and don't just get wasted all the time-- which is what I would have done, I'll tell you that.
但巴黎人很快成立了中央卫生委员会,旨在宣传并鼓励人们,健康饮食,告诫人们不要总是浪费时间,老实说,如果我在那里的话,早就这么做了
- But there's one potential gotcha here -- and this is where you have to be kind -- of piecing together the little clues along the way -- what have I done that's interesting here that had I not, I would have had a mathematical error?
但是这里有一个可能性-,这就是你需要把,一些线索拼凑在一起-,我这里所做的是很有趣的,如果我不这样做,我可能已经犯了个数学错误?
If you did that, on some level, I think, you were absolutely right, even though you were utterly misconstruing the logic of the argument.
如果你那么做了,我认为在某种程度上你们是绝对正确的,即使你们完全理解错了这论证里面的逻辑。
So, assuming -- if anyone got it wrong because of that, that's my apologies, that's my fault.
如果有人是因为这个原因做错了,那我非常抱歉,这是我的错。
Secondly, as we go to the more advanced part of the course, we'll take a result from this part of the blackboard, stick it into the second part and keep manipulating, so if I screwed up in the beginning and you guys keep quiet, we'll have to do the whole thing again.
其次,随着我们课程的深入,我们需要把黑板这边的计算结果,抄到黑板的那边,不停地这么做,如果我一开始就写错了,而你们又不出声,我们就得全部重新来过
This is what I've done, if you hear about anything, I'm looking for a job..."
这是我做的东西,如果你听说了什么,那就是,我正在找工作……”
And I think you will wish you are continuing to make the investment in time. If you are down here, what I want you to do is talk to somebody.
我想你希望再接再厉,保持花在这么门课上的时间,如果你退步了,我要你做的就是和某人交谈。
So I need to find out the heats of formation of the iron oxide and the water.
所以我需要找出氧化铁和,水的生成热,如果我这么做了。
I do something stupid, it's an off day.
如果我做了蠢事,那是因为我那天不在状态。
if I were rich, I would do this for free because I love to teach.
如果我赚够了钱,我想做义务教学。
Sometimes it's just a sandwich if I'm tired.
有时如果我累了,就只做一个三明治。
In some sense, strictly speaking they shouldn't be necessary because the fact that my specification starts with an assumption, says, hey you, who might call square root make sure that the things you call me with obey the assumption.
在某种意义上严格的来讲,它们不是必要的,因为我已经对假设做了声明,也就是说,如果你要调用我的,求平方根的函数,请确保你传递给我的,参数满足假设条件。
And I think in the polar one I said, if, what did I do there, I said, yeah, again if the x and y are greater than the other one, I'm going to return them to it.
然后我要返回一些值,我认为在极坐标的形式下我说过,如果,我在这里做了什么来着,我说过,对,再说一次,如果x和y坐标。
What does it expect as input, and any other information I want to pass on.
但是如果我去做了,我将要说明这个函数是干什么的。
It says, right. If j is-- well it says until j is at the less than the length of l-- it says, if min value is bigger than the thing I'm looking at I'm going to do something, all right?
只要j比长度l小,如果MinVal比我要找到元素大,我就要做些什么了,我们来遍历?
And so, if I do that, this now becomes really easy.
如果我这样做的话,这个问题就会简单点儿了。
We're checking the end test and incrementing, actually I was going to, I commented that out for a reason you'll see in a second, but I, normally I would keep this on, which would let me, at each step, see what it's doing. If I ran this, it would print out each step. Which is helping me make sure that it's incrementing the right way.
对不对?进行终结测试然后递增,实际上我要,因为某些你们,马上要明白的原因我把这里注释了,但是我通常会一直这么做,这样能让我看到每一步都做了什么,如果我运行这个程序,它会在每一步都,进行显示,这能帮助我让我确信程序是,在以正确的方式递增。
The format is the same. I'm going to ask for some input, and then I am going to use that procedure to check, is this the right type of value. And I'm trying to use that to do the coercion if you like. Same thing if it works, I'm going to skip that, if it not, it's going to throw the exception.
格式是一样的,我需要一些输入,然后我要用一个过程来检查,是否是正确的值,然后你就可以做强制转换了,如果能运行,那是一样的,我打算跳过这段,如果不正确,那就会抛出一个异常。
Computing square root. I'm going to capture it in a piece of code, I'm going to be able to refer to it by a name, and I'm going to suppress the details, meaning inside of that computation, you don't need to know what it does. You just need to know, if I give it the right kind of input, it'll give me back an input that satisfies the contract that I set up.
比如计算平方根,我会用一段代码来说明,我将给它命名,并且忽略细节,意思就是在这一段计算过程中,你不用知道它做了什么,你只需知道,如果我进行了正确的输入,它将会给我符合条件的输出。
And notice, by the way, if I do that, and I type sqrt and open the paren, ah-ha! It shows me what the creator, in this case actually I stole this from John so what Professor Guttag put up as his specification for this piece of code.
它需要什么养的输入和其它我想传达的信息,如果我这么做了,我将会到这里打上sqrt并且加上括号,啊哈!这里告诉我这段程序的创建者,事实上这是我是从约翰那里偷来的,所以也就是Guttag教授在它的。
应用推荐