Sharks glided in lazy loops around them, dragging their backs along the rafts,waiting.
VOA: special.2011.05.04
Well, let's take a look at this high7 variant that also use loops that also uses a loop. So this one is a little cute, I like to think. So notice this.
让我们看下这个仍然使用了循环的版本,这个有点意思,我认为,注意这个。
Okay, not to dwell too much on math because you can very quickly bore someone in computer science by dwelling too much on math but it's useful even for logical constructs as we'll see with loops.
不要过于纠结于这些数学问题了,在计算机领域,你会很讨厌那些,在这上面钻牛角尖的人,但是对于那些,像循环这样的逻辑结构又是很有用的。
OK, so what have I done? I just added a little bit more now. I'm now running through a pair of loops. Again notice the encapsulation, that nice abstraction going on, which is what I want. Once I get to this stage though by the way, there might be more than one solution.
我现在运行了一对循环,再一次注意这个封装,抽象得很好,这就是我想要的结果,我按这种方式走到这一步的时候,可能会有多组答案。
So in a sense, that's a good infinite loop that is as long as you're using the program, it's constantly checking your grammar and spelling, and underlining things, so infinite loops aren't necessarily bad if the objective is actually being met.
因此从这个意义上说,这是个好的无穷循环,只要你开始使用这个软件,它不停的检查你的语法,拼写或者下划线等,通过这种方式达到目标的时候,这样的无穷循环并不总是坏的。
There are so many other constructs like loops and conditions and such, so what I thought we do in conclusion today is look at this program.
这里有很多其他结构类型如循环控制,条件分支等等,所以我觉得应该,以这个程序作为结束。
We saw some quadratic algorithms, typically those are things with multiple nested loops, or iterative or recursive calls, where you're doing, say, a linear amount of time but you're doing it a linear number of times and so it becomes quadratic, and you'll see other polynomial kinds of algorithms.
我们看过一些平方算法,他们一般进行了多次嵌套循环,或者递归迭代调用,对一个线性操作调用线性次,这样就变成平方次了,以后你们能看到,一些多项式算法。
OK. Let's think it through. I've got two loops.
据它内部的内容来判断。
Well loops are something we talked briefly about.
首先我要简单介绍一下“循环“这个概念。
It's running through a similar set of loops.
它执行的是相似的一套循环。
So now, loops.
现在我们写个循环。
Which is iteration. Or loops.
也就是迭代,或者循环。
The rest of that code's a pair of loops.
剩下的代码就是一对儿循环。
Now I seem to be violating my own mantra here by just calling this variable A, but this is reasonable, I much as with four loops when you just call an incrementing variable I, because you just need an index, well, same here.
现在我好像违背了我自己的意愿,我把这个变量叫做A,但这是合理的,就像我们的for循环中,我们把一个增变量叫做,因为我们只要一个索引,这里也一样。
Because the for loop hands me placeholders in between those semicolons for variables and such, now I don't have those with while loops.
因为for循环给我提供了为变量准备的占位符,它们在分号之间,现在在while循环中,我没有这些。
So in addition to for loops like this, know that there are while loops.
除了像这样的循环之外,你们知道还有while循环。
The pieces that we pulled off the shelf here were ultimately reduced to things like 4 loops and what we'll call functions and what we'll call abstraction; and all these fundamentals that at first glance might have some fairly RK and jargon associated with them.
我们可以把现有的课程,分为四大领域,以及应用型课程和抽象理论课程,乍一看,所有这些基础课程,都可能会和RK及与之相关的术语联系在一起。
So unlike Scratch where you pretty much had to say "repeat" ten times or whatever, or forever where it's just "forever" with for loops, -- can you actually specify a finite number of iterations -- and as I learned 15 years ago, finite is important.
所以不像Scratch,你大致上需要用,“repeat“10次或更多,或者需要不断地使用当它,是死循环时,你们能够指定出一个有限的迭代次数-,像我15年前学的,有穷的是重要的。
These are things like FOR and WHILE loops.
比方说for和while循环语句。
Well, we saw loops in Scratch.
嗯,我们在Scratch中看到了循环。
应用推荐