It is going to give me back a tuple a collection of two things, and so check out the syntax.
它将给我返回一个数组或者系列的一对值,然后检查一下语法。
Same way that I have multiplication or division as a primitive, functions are going to give me, or somebody else who wrote them for me as part of a library, a new primitive that I'm going to be able to use.
我在用乘法或者除法当做原语,这些函数,或者别人写程序库中的函数,将会给我返回一个,我能使用的新原语。
So I want to go back again, now we're considering the line on the board as being flavor in beer, or location in a town, and I want to go back to politics now and go back to the interpretation we started with, so that left and right will end up being left-wing politics versus right-wing politics.
所以我想返回去,现在我们将黑板上的线看成,啤酒的口味或城市的位置,我现在再回去讨论政治,回去解释我们最初,把线的左边和右边,看成左派和右派的原因
Odds are when this function called gets a string from the user by expecting them to manipulate their keyboard - with their fingers, I need to-- initiatively I'm gonna get back a sentence or a word or a phrase or something.
调用GetString获取的信息也有可能,是通过键盘敲进来的,东西-,它将会返回句子啊,单词啊,或词组啊等等一些信息。
Then if the weight of i is less than the available weight, I can return the value of i.
然后如果i的重量,小于剩下的重量,我将返回i的价值。
I can give two names, which will get bound to the two parts of that return tuple.
我可以给它设两个变量,返回的一对值将会被赋给这两个变量。
So the first thing I'm going to do is, I'm going to try and return the value in the memo.
所以我要做的第一件事,就是我将会尝试将,总价值返回到memo中。
Knowing that, I'm going to say, OK, how many pigs are there, well that's just how we're, however many I had total, minus that amount, and then I can see, how many legs does that give, and then I can check, that the number of legs that I would get for that solution, is it even equal to the number of legs I started with, ah! Interesting. A return.
它将给我返回头的总数,知道了这些之后我可以说好了,有多少猪呢,无论有多少组鸡的数目,我只要用总数减去那个值,之后我就可以知道一共有多少条腿,然后再把这个值和题目中的腿数相比较,看它是否等于一开始的腿数,啊!真有趣,有一个返回值。
And then to create the object, I'll simply do a set of inserts.
我将此返回做为我的集合,然后创建对象,我会一系统简单的插入操作。
All right? So if I called sqrt alone, that return test value is done, but in this case I bound it to test, so I can go look at test, and there it is.
执行完返回值语句,但是在这里我将把它赋值给,所以当我看test的值的时候就是返回的值。
So what's going to happen here? If I'm inside this FOR, OK, and I'm running around, if I ever hit a place where this test is true, I'm going to execute that return, return that return returns from the entire procedure. OK? So the return comes back from the procedure.
那么这里发生了什么呢?,如果我是在这个for循环里面,我正在运行,如果我运行到test的值为真的地方,我就会执行,这个return将会返回整个程序的值,明白了吗?所以它将会从整个程序中返回值。
应用推荐