a = b – Talk
Jump to navigation
Jump to search
(b:Anything ?) |
Killzone Kid (talk | contribs) No edit summary |
||
Line 14: | Line 14: | ||
If '''b''' is [[Anything]] it could also be [[Nothing]], which in turn cannot be assigned to a variable. | If '''b''' is [[Anything]] it could also be [[Nothing]], which in turn cannot be assigned to a variable. | ||
--[[User:Alef|alef]] 11:46, 19 June 2008 (CEST) | --[[User:Alef|alef]] 11:46, 19 June 2008 (CEST) | ||
<!-- CONTINUE Notes --> | |||
<dl class="command_description"> | |||
<dd class="notedate">Posted on October 3, 2014 - 18:38 (UTC)</dd> | |||
<dt class="note">[[User:MulleDK13|MulleDK13]]</dt> | |||
<dd class="note"> | |||
The assignment operator is the only operator that isn't really an operator. It is a special construct.<br /> | |||
Take for example, the following expression: | |||
<code>hello + 5</code> | |||
Assuming ''hello'' contained the value ''10'', ''hello'' would evaluate to ''10'', and ''10 + 5'' would finally evaluate to ''15''.<br /> | |||
<br /> | |||
Which is why the assignment operator wouldn't work as a regular operator.<br /> | |||
Take for example, the following expression: | |||
<code>hello = 10</code> | |||
If the assignment operator was a regular operator, ''hello'' would first evaluate to ''[[nil]]'' and finally ''nil = 10'', which wouldn't make a whole lot of sense.<br /> | |||
<br /> | |||
To work as a regular operator, and like any other operator requiring a reference to a variable rather than the variable's value (Eg. [[isNil]] and [[publicVariable]]), its syntax would have had to be. | |||
<code>"hello" = 5</code><br /> | |||
</dd> | |||
</dl> | |||
<!-- DISCONTINUE Notes --> |
Revision as of 09:57, 4 October 2014
I thought "Equals a to b" is clearer, as it shows that it is an active process, as "a equals b" sounds more like a comparison. But I'm neither a native speaker nor is this command that unclear ;) --raedor 17:51, 16 December 2006 (CET)
- How about this one: Assigns content of b to variable a.. That should be pretty obvious to anybody, what it means. --Kronzky 18:08, 16 December 2006 (CET)
- I think planck confused a = b and a == b. I agree with Kronzky, the new definition is much more clearer. --Sniperwolf572 18:16, 16 December 2006 (CET)
- I can live with that one. :) --raedor 19:27, 16 December 2006 (CET)
- No, Planck didn't confuse this with a == b, I was just at a loss as to where this command comes from as it isn't really in the comref. Anyway the latest definition is fine. Planck 22:43, 16 December 2006 (CET)
Note that array1=array2; array2=[1,2,3]; makes array1=[1,2,3] as well since it's more like a "pointer", not a copy of. array1=+array2 *is* a copy. Confused? :) --Doolittle 18:44, 8 July 2007 (CEST)
b:Anything ?
If b is Anything it could also be Nothing, which in turn cannot be assigned to a variable. --alef 11:46, 19 June 2008 (CEST)
- Posted on October 3, 2014 - 18:38 (UTC)
- MulleDK13
-
The assignment operator is the only operator that isn't really an operator. It is a special construct.
Take for example, the following expression:hello + 5
Assuming hello contained the value 10, hello would evaluate to 10, and 10 + 5 would finally evaluate to 15.
Which is why the assignment operator wouldn't work as a regular operator.
Take for example, the following expression:hello = 10
If the assignment operator was a regular operator, hello would first evaluate to nil and finally nil = 10, which wouldn't make a whole lot of sense.
To work as a regular operator, and like any other operator requiring a reference to a variable rather than the variable's value (Eg. isNil and publicVariable), its syntax would have had to be."hello" = 5