More gloriously, we could imagine building some kind of a robot that does a variety of tasks.
说得再远一点,想象我们正在开发机器人,那种可以执行各种任务的机器人
So let me expand on that very slightly, and again we did this last time but I want to do one more time. I have to be careful about how I'm actually implementing a list.
我们之前做过了一次,但还是再做一次吧,我得小心的在列表中执行,例如在这个例子中。
But we'll do that again correctly next time.
我们下次再来执行一次。
OK, if you look at that then, let's look at what happened when we ran this.
好的,如果再看一下那个,让我们看一下当我们执行这里时会发生什么。
Having reached the end of the block, go back up and check the test.
执行到了这块代码的最后,程序会回去再做一次测试。
So, evaluate the same sequence of instructions again.
那么再去执行一遍,相同的指令。
And what it's saying semantically is, using that variable as my placeholder, have it walk through this collection, starting at the first thing, execute that code, then the next thing, execute that code, and so on.
它的语义意思就是,把这个变量应用为我的占位符,用它来遍历这个集合,从第一个元素开始,执行代码,然后下一个元素,再执行代码。
At the end of the day, you can implement the exact same program using a while loop that you can using a for loop, it's just your code is going to look slightly different.
最终,你可以执行这个程序,再使用for循环的地方使用while循环,这只是使你的代码看起来稍微有点不同。
It's 1. Is it less than or equal to 16? Sure.
改变ANS,x不变,再去执行测试。
应用推荐