Author: steve happ | Email
Website : www.video-animation.com
Advertisement
Operators
Operators are signs that do something to variables on either side of them.
Here are the arithmetic operators:
| Operator | Name | Example |
|---|
| * | Multiplication | X* Y |
| / | Division | X/Y |
| % | Modulus | X % Y |
| + | Addition | X + Y |
| - | Subtraction | X - Y |
The Modulus operator(%) computes the remainder of division between 2 integers.
e.g. 5 % 2 = 1
5/2 = (2*2) + 1(remainder)
Try it out!
Ex1.
var x = 3;
var y = 5;
var mult1 = x * y;
trace(x + " times " + y + " = " + mult1);
ex2
var min = 35;
var max = 239;
var addition = min + max;
trace(min + " plus " + max + " = " + addition;
You get the idea. Try all the operators and start writing your own scripts.
Equality, Relational and Logical Operators
These operators evaluate to true or false
Logical AND (&&)
Evaluates to true only if both its operands evaluate to true. E.g.
x = 5;
if(x>0 && x < 10){
something = true;
}
trace(something);
BOTH MUST BE TRUE.
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section
Submit your Tutorial at Click Here