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.
让我们看下这个仍然使用了循环的版本,这个有点意思,我认为,注意这个。
If we weren't so pressed for time, I kinda wanna see how long we could get away with this before it gets awkward, but that, in fact, is an infinite loop t hat's hopefully deliberate.
如果有时间,我想看看,我们需要花多长时间解决这一问题,事实上,它是我故意,使用的无穷循环。
Any questions about going through these cycles and using expressions like this and so forth? Expressions like this you know turn up in various places, like in the equations sheet that appears at the end of exams, right?
关于推导这些循环和使用,这样的表达式之类的,有没有什么问题?,这样的表达式在各种地方都会出现,比如试卷后面的公式页?
printf So here I'm culling printf in a loop again and again, but I'm literally overwriting the previous thing that I wrote.
所以这里我一次次地在循环中使用,但是我逐行地覆盖了我之前所写的东西。
And we won't wait here one hundred seconds for it to finish, but we're using the loop, we're updating a variable, and we're formatting it in a nice way.
我们将不会再这里等待100秒来等它完成,但是我们使用循环,我们更新一个变量,我们把它排成一个漂亮的格式。
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.
因此从这个意义上说,这是个好的无穷循环,只要你开始使用这个软件,它不停的检查你的语法,拼写或者下划线等,通过这种方式达到目标的时候,这样的无穷循环并不总是坏的。
Now, I wanted to go to through this just to go through one cycle quickly because we're going to be doing these all the time, and the importance of the fact that the path doesn't matter, and you can always connect things together in a way, whatever you want.
我使用这种,利用热力学循环的推导方法的原因在于,今后我们,将经常使用类似的方法,大家要记住路径是无关紧要的,可以随意选取一条路径,来连接两个态。
Otherwise, it's a pretty bad mistake, but sometimes you do want an infinite loop, Word for instance, Microsoft Word if you use it or pages or the like on your Mac or PC.
否则,它将会是一个错误,但有时你确实需要一个无穷循环,例如微软的,当你在Mac或者PC上使用它时。
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循环,这只是使你的代码看起来稍微有点不同。
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年前学的,有穷的是重要的。
I'm again, iterating with this four loop, same code as before.
我再次,重复使用for循环,同样的代码。
And you'll find in the end that recursion is a feature of a language, it allows you to map some very obvious concepts like the phonebook tearing in half and half and half and half to actual code without it using some arbitrary human contrived framework like a for loop or a while loop which are much more stilted mechanisms.
最后你会发现递归是某种语言的一种特征,你可以用它将一些非常明显的思想,比如将电话簿划分为一半又一半,映射为实际代码,而不必使用那些人为框架,像for循环,while循环之类的,那是很呆板的机制。
应用推荐