• The difference with the do while loop, as the syntax kind of suggests, is that this construct is going to do something no matter what.

    作为建议的语法,do,while循环的不同之处,是这个结构不管怎么样,它会做一些事情。

    哈佛公开课 - 计算机科学课程节选

  • 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循环,这只是使你的代码看起来稍微有点不同。

    哈佛公开课 - 计算机科学课程节选

  • Ah ha, it goes into that accept portion, prints out a message, and goes back around the while loop to say try again. And it's going to keep doing this until I give it something that does serve as a float.

    他会说输入一个浮点数,啊哈,它就到了那段处理代码,打印出消息,然后回到while循环让我们再输一次,它会持续这么做直到它接受到一个浮点数。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I probably whip out a do while loop very rarely, but very often when programming games or any program that takes user input and has to check that user input and yell at the user if they're messing with you or aren't providing what's expected.

    我可能很少用do,while,循环,但常常是,当编制程序游戏或需要用户输入的程序是,需要检查用户的输入并提醒用户,如果他们干扰了你,或没有提供所期望的输入。

    哈佛公开课 - 计算机科学课程节选

  • So this do while loop immediately breaks out at the point of that check.

    所以这个do,while,循环在检查的时候,直接中断了。

    哈佛公开课 - 计算机科学课程节选

  • So conceptually the key difference here, besides the syntax looking slightly different, it just means that if you want a chunk of code to execute no matter what initially, ; you can use the do while loop; if you want to check a condition first, you can use the while loop.

    所以概念上,则关键的区别是,除了语法看起来有点不同,它的意思是如果你想要一段代码,最初无论如何都要执行,你就可以用do,while循环;,如果你想要先检查条件,你可以用while循环。

    哈佛公开课 - 计算机科学课程节选

  • Now instinctively, prefer the for loop or the while loop?

    现在凭感觉,你们喜欢for循环还是while循环?

    哈佛公开课 - 计算机科学课程节选

  • The key part of that is that WHILE loop.

    关键的部分是这个while循环。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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循环之类的,那是很呆板的机制。

    哈佛公开课 - 计算机科学课程节选

  • Then we have to steal the code from earlier to do a forever loop, a while true loop and then I'm gonna go ahead and use that printf thing that we saw.

    然后再借用先前的代码,做一个永久性的循环,即while循环,紧接着需要用到一个,之前我们看到过的printf函数。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定