AS: Little Tricks and Tidbits!
Feel free to add your own little-known AS tricks to this thread.
The ?: Operator
How it works:
a==b?c=d:e=f
is the SAME as
if(a==b){
c=d
} else {
e=f
}
Can be very useful for short if statements. If there is no else part, use
:null
The Modulus (%)
I think it's called the modulus...
Well anyway it returns a remainder
a=random(1000)
a%2 //returns the remainder of a/2, so if a is odd it returns 1, if even it returns 0
Really nifty gidget. Very useful.
Ok that's all I got for now. Anyone else can post their tricks too.
Post yours!
Post yours!
Post yours!