edit: problem solved thanks to chrishirst!
Hi,
Never coded before but decided I will learn Actionscript 3.0 as my first programming language to give me a stranglehold on Flash as a whole.
So I've bought the Foundation Actionscript 3.0 with Flash CS3 and flex which so far has been a good read and at times I have been stuck on paragraphs trying to figure out the coding examples which I eventually come to terms with, however, I've come across one section which doesn't make sense to me:
In the section for Allowing for variable parameters
I cannot seem to understand what is going on here..
Quote:
straight from the book
When an arithmetic operator is followed by the assignment operator, the variable to thje left of the operators has its value operated upon along with the operand to the right of the operators, with the calculated result assigned directly back to the variable. here are a few more examples to help demonstrate.
Code:
var number:uint = 2;
number += 5; // results in 7 now being assigned to number
number -= 3; // results in 4 now being assigned to number
number *= 2; // results in 8 now being assigned to number
The same operation can be used with the concatenation operator (+) with strings:
..etc
|
I'm sorry but I can't seem to figure out this system here. The variable number = 2, so 2 + 5 = 7 for the first, which makes sense but how does the result of 4 and 8 come around for the second and third examples?
p.s. While I'm at it; How difficult is this language, generally speaking? How was it for you AS-coders?
Thanks in advance!
Last edited by StylaStyla; 07-30-2008 at 10:50 AM..
|