So that's the key thing to-- to realize; that what the assignment did was have two separate paths to the same object.
认识到赋值会造成两个独立的绑定到;,同一对象上这件事情很关键,因此我可以通过这一条或者。
OK, now that I've got that, we could think about what would I want to do with these points?
我也可以像以前那样,对它们进行赋值操作,好,现在我们已经有这些对象了?
Number three, pointer assignment, takes one pointer and changes it to point to the same pointee as another pointer so after the assignment the two pointers will point to the same pointee.
第三条,指针赋值,使一个指针,指向另外一个指针所指向的数据,赋值过后,两个指针会指向,同样的数据。
One over two squared minus one over n squared 3 4 5 where n takes values three, four, five, six.
除以,2,的平方再减去1除以n的平方,将n赋值为。
I'm gonna keep as part of each stock, it's history of prices, which we can initialize, well, I've initialized it as empty, but that's probably the wrong thing, right?
我会把股票的历史价格,作为每只股票的一部分,我们可以先对它的历史价格进行赋值,好了,我先给它赋了空值,但是这样做可能不对,是吗?
All right, c p 1 dot y, x I've said assign that to the value 2, 2,0. So now c p 1 has inside of it an x and y value.
一个特定的版本,我现在命名了一个内置变量,并给它赋值了,我刚刚做的也就是给它。
self y Notice what I also do here, I create self dot y, give it a value, and then, oh cool, I can also set up what's the radius and angle for this point, by just doing a little bit of work.
我创建了,然后给它赋值,然后,噢太酷了,通过做一点额外的工作,就可以得到点的半径和角度了,好,实际上如果。
- And here as promised is that other operator -- looks a little weird, but because assignment is already using the equal sign to assign one value on the right to a variable on the left.
在这里正像所承诺的那样,其他的操作-,看起来有点怪异,但是因为“=“已经被用来当赋值运算符了,用来把右边的一个值赋值给左边的变量。
There's a function in purple, there's a string in green, and in black I have the assignment statements.
还有个粉色的方法,绿色的字符串,赋值声明是黑色的。
So if you don't actually assign to something, it falls on the floor and the value goes away.
所以是,如果你没有赋值,它掉在地上,那个值就不存在了。
Well, the assignment operator makes a copy of the thing on the right and puts it in the thing on the left.
赋值操作符把右边的东西,复制到左边。
Let's let p be Cartesian point, and we'll give it a couple of values. OK?
然后我们给它赋值,好不好?,发生了什么?
I probably should have had it being the, starting here, right, the opening price.
我可能应该从这里进行赋值,也就是开盘价格。
So far, we have the following in our language. Right, we have assignment.
至今为止,我们已经学习了,该语言的以下内容,我们学习了赋值语句。
n I know this is okay because I'm not using n until I myself put something there.
我知道这是正确的因为我不会使用,直到我给它赋值了。
I can give two names, which will get bound to the two parts of that return tuple.
我可以给它设两个变量,返回的一对值将会被赋给这两个变量。
x Inside of that structure, create a variable name x, and a value associated with it.
创建了一个变量名为,然后给它赋值,请注意我也在这边做的操作。
So this is the equality operator, whereas the single equal sign is the assignment operator.
所以这是相等操作符,然而那个单等号是一个赋值运算符。
Having already chosen to use equal as an assignment, I need something else to do comparison.
既然等号是,用来赋值的,我需要用一些东西来做比较。
So in particular, that is an assignment statement.
特别要说的是,这是赋值声明。
And then I could do things like again, say, okay having done, that let me just run it here, run that, so I've now got polar point 1, and polar point 2.
然后给它们赋值半径和角度,然后我可以进行刚才的操作,也就是说,对刚才的笛卡尔坐标进行的操作,让我们来运行下它吧,运行下,现在我有一个极坐标点。
And it's up to me to put that return value in a variable.
那个放在变量中的值是取决于我所赋的值。
All right, so let's make it the list 123.
好,还是给这个数组赋值为123好不好?
Then when I create the stock, here, I can pass it in, pass in d 1.
然后当我在这里创建stock的时候,我可以给它赋值,把d1赋给它。
The equal sign is really called the "assignment operator."
那个等号其实是个“赋值运算符“
p2 It's taking the name p 1 and it's changing its value to point to exactly what p 2 points to.
我要把p1赋值为1,这个操作有什么用呢?,这个操作把p1这个名字的,指针的值改变让它。
So the assignment operator thus far makes copies of things.
所以到现在为止,赋值运算符复制了很多数据。
And so we saw that as well, the last piece we had here is the ability to create variables, which have their own values, and that's done using an assignment statement.
我们也可以看到,这里我们最后的是,创建了一些变量,这些变量都有自己的值,这是运用了赋值声明来完成的。
Well, the first three statements are just assignment statements.
好,前面三个声明仅仅,是赋值声明而已。
I just do a copy paste of that.
我刚赋值粘贴了那个。
应用推荐