At 6/27/06 07:42 AM, phyconinja wrote:
you can have :
-= (number=number-"somthing")
+= (number=number+"somthing")
++ (number=number+1)
-- (number=number-1)
You're forgetting the other assignments:
vari *= 2 // returns vari as its previous value multiplied 2
vari /= 2 // returns vari as its previous value devided by 2
vari %= 2 // returns vari as its remainder when divided by 2 - particularly useful if you want a variable to go to a certain number then reset.
May as well do multiple declerations too:
var vX:Number = _root._xmouse;
_x = vX
Can be shortened to:
var vX:Number = _x = _root._xmouse;
Also, you could have put a more detailed description of the use of variables in conditions. a condition checks if something is true or false, so while:
good = true;
if(good == true){
}
Will return true and execute the code, because good being equal to true is true, you may as well have:
if(good){
}
Becuase the value is returning true anyway. Similarly, instead of having:
if(good == false){
}
You can just put:
if(!good{
}
From a binary point of view, it's also worth remembering that any non-zero and non-NaN or undefined number returns as true in these conditions (I think :P), so:
good = 5;
if(good){
}
Should also work.
Don't quote me on that last bit, though :P