It says if this is a string of length 0 or 1, I'm done. I'm going to return the answer true.
我就会返回答案为真,否则的话我得判断它。
They otherwise don't have that chance.
否则的话,他们没有这个机会。
Think about that. That says, if this thing has some particular value, I want to do one thing; otherwise, I want to do something different.
考虑考虑,这意味着,如果这个事情有一些特殊的值,我就去做一件事情;,否则的话,我就会去做另外一件事情。
Otherwise, what was the point of getting a string from the user if I'm not handed the result to actually do something interesting with.
否则的话,它不把值带给我们,我们就做不了想做的事情,那我们还要它有什么用呢?
And obviously, that ought to involve the variable in some way, or it's not going to make a lot of sense, so this includes the variable, since that's the thing that's changing.
很明显,这跟计数器的变量有某种关系,否则的话就没多大意义了,因此这跟计数器有关,因为它正是每次循环改变的东西。
If it's at that point, I'm done, if not, if it's greater than the value I'm looking for, I either take one half or the other.
那么我就取左边,否则的话就取右边,好,你们可以明白,我们一次就可以缩小问题规模的一半了吧。
It says, well I'm going to print out first and last just so you can see it, and then I say, gee 2 if last minus first is less than 2, that is, if there's no more than two elements left in the list, then I can just check those two elements and return the answer.
然后它计算了尾点和开始点的差,如果小于2的话,也就是说数组中的元素小于等于,我对这两个元素进行比较,然后返回结果就可以了,否则的话,我们就去寻找中值点,注意它是怎么实现的,首先这个指向一个列表的开头。
If something is true do this, else something is true, do that.
如果某些条件是真的,就做这件事,否则另外一些条件为真的话就做另外一件事。
So if this is true do something else, true otherwise test and see if this is true, do something else, as many as I like followed by the end.
因此如果结果为true那么做一些操作,否则的话再看看这个表达式的值是不是,如果是的话做另外一些操作,我想要多少后面就可以跟多少。
All right, if this is purely a test of, if this is true do this otherwise I don't care, I don't need the ELSE clause in there to identify it. All right?
好,如果这真是一个测验,用来测试如果是真的那么进行一些操作,否则的话我不在乎,那么我不需要ELSE语句,来进行声明了对不对?
应用推荐