a = b – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 36: Line 36:
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->


:::: @MulleDK13 I have really difficult time understanding what you are trying to say, this is why I moved it here. Are you saying that a = 10; b = a; a = 5; b will have to be also 5?  --KK
<br><br> @MulleDK13 I have really difficult time understanding what you are trying to say, this is why I moved it here. Are you saying that a = 10; b = a; a = 5; b will have to be also 5?  --KK

Revision as of 22:50, 5 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)

Array operations are actually covered in the Array article. --Kronzky 22:54, 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



@MulleDK13 I have really difficult time understanding what you are trying to say, this is why I moved it here. Are you saying that a = 10; b = a; a = 5; b will have to be also 5? --KK