We're gonna have a so called a loop, an infinite loop and you actually experience this in the real world.
我们将会做一个循环,一个无限循环,你会在这个,真实世界里体验它。
Now, all the cat is doing is that it's an infinite loop and it's checking if I am not facing bird, - face bird, and it's -- It's constantly chasing the bird.
猫能做的就是一个死循环,并且它能检测我是不是面对着一只鸟,如果没有就转向那只鸟-,它一直不停地追逐这只鸟。
Well, you'll know when it crashes, that doesn't help you very much, but you can't always tell whether something's stuck in an infinite loop or whether it's simply taking a long time to compute.
好,你将学到它在什么时候会崩溃,这对你帮助并不大,但是你不能辨别出到底是在一个循环中,有什么东西卡住了呢,还是程序需要很长的时间来计算一个结果呢。
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.
如果有时间,我想看看,我们需要花多长时间解决这一问题,事实上,它是我故意,使用的无穷循环。
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.
因此从这个意义上说,这是个好的无穷循环,只要你开始使用这个软件,它不停的检查你的语法,拼写或者下划线等,通过这种方式达到目标的时候,这样的无穷循环并不总是坏的。
Well, I'm going to create a little infinite loop.
好,我会建立一个小的无穷循环。
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上使用它时。
And remind you that inside of here, I'd better be changing the variable. All right, if that variable that's counting is not changing I'm going to be stuck in an infinite loop, so I ought to that, right, expect somewhere in there, a change of that variable. All right?
我最好改变了计数器的变量值,好,如果计数的变量没有变化的话,我就会被卡在一个无限循环里面,因此我应该【不可闻的声音】,对,在这里的某个地方,改变下计数器的变量,对不对?我要做的最后一件事情就是?
It's going to run through the loop, accumulating the answers, but because I'm subtracting, x it's just going to keep making x more and more negative as it goes along, again it's off into an infinite loop.
它一直在循环,不断的累加答案,这是因为我一直在对x做减法,这使得作为负数的,变的越来越小,又进入一个无限循环了。
If you're not updating some variable by incrementing it or decrementing it -- if you're not changing anything, presumably the conditions are never going to evaluate to false or the opposite, so you're just going to have an infinite loop, which might be your goal, but odds are it's not.
如果你不通过增加或减少它来改变一些变量,-如果你不改变什么,大概那个条件永远不会变成错误的,或相反的,所以你将得到一个无限循环,那可能是你的目标,但可能也不是。
If I'm iterating from I on the outside, I on the inside, I'm going to start changing the value and I might very well induce an infinite loop but J is okay.
如果我在外面从I开始迭代,或从里面开始迭代,我将开始改变它的值,我可能引起一个无限循环,但是用J是可以的。
So a loop or an infinite loop, because true is always true, there is no-- nothing on the screen that seems to change this keyword true, so this is actually a deliberate infinite loop, but so was that thing up top to forever say hi or whatever it is you wanted to do.
因此而出现死循环,屏幕上的这些语句无论怎么运行,都无法改变它为真的事实,这就是所谓的死循环,无论你想不想要,屏幕上都会不断打印出“hi“
应用推荐