It would definitely be wrong if we were doing this because little sanity check if you just got the single one it means what instead?
如果我们这样做就是错误的,一个小检查,如果你用单个“=“,是什么意思?
and say, "You've not checked it properly. We are in England, use the English language."
然后说,“你没有正确地检查它,我们在英国,请用英式英语。”
We'll use more sophisticated tools before long, but let's do a little sanity check.
我们不久后将用更多的复杂的工具,但是让我们做一个明智的检查。
And so, he has put this chemistry to use in this robotic arm and they call it Fido, because often dogs are the creatures that have to go out and detect these things, and it's not a great job if you're a dog to be sent out to see whether there was an explosive and discover yes, there was, a little bit too late.
因为通常都是派狗去检查这些东西,这个不是个好工作,如果你是一只狗,被派去检查是否有爆炸物,然后你发现有,那就来不及了,所以用机器手检查化学物质。
So the way to think about this in terms of flow is, it starts with that if and it says, check both of those things.
因此用控制流的方式,来考虑这件事就是,程序由if开始,然后要对两件事情,都进行检查。
But when you start writing programs, especially when we get to web-based stuff where you want -- to check the user's input -- is it valid, is it an email address, -- and all these different scenarios -- it's actually often useful to be able to just enumerate them or rattle them off using this switching construct instead.
但是当你看是写程序时,特别是当我们,使用基于网络的东西,你想要,检查用户的输入-,它是合法的吗?它是不是一个电子邮箱地址?,所有的这些场景-,实际上它常常是有用的,当你用枚举结构列举它们,或者用它来快速地来说出它们。
OK. All right, let me show you one other tool that I want to use. Which is, I've written that piece of code, I ought to check it. Well, I could just run it, but another useful thing to do is, I'm, especially as I want to debug these things, is to simulate that code.
好,那么,让我给大家讲下,我想用的另外一个工具吧,也就是,我已经写好了这一块代码,我应该去检查检查,那么我可以去运行它,但是特别是当我想要调试代码的时候。
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,循环,但常常是,当编制程序游戏或需要用户输入的程序是,需要检查用户的输入并提醒用户,如果他们干扰了你,或没有提供所期望的输入。
The format is the same. I'm going to ask for some input, and then I am going to use that procedure to check, is this the right type of value. And I'm trying to use that to do the coercion if you like. Same thing if it works, I'm going to skip that, if it not, it's going to throw the exception.
格式是一样的,我需要一些输入,然后我要用一个过程来检查,是否是正确的值,然后你就可以做强制转换了,如果能运行,那是一样的,我打算跳过这段,如果不正确,那就会抛出一个异常。
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循环。
应用推荐