Operators

Operators

Operators are special functions that take one or more operands and return a value or result (think of the basic arithmetic operators for addition, substraction, multiplication and division as an example).

An operand is also a value: it can be a literal value (a number), a variable (that contains a different valuer at different points through the application), or an expression (of numbers, variables or both). The operator uses the operands as input to return a value.
Link to the Adobe Actionscripting 3.0 operators reference, HERE

Condition Statements and comparison operators

The if Statement works like in most programming languages:
if
(myValue == 1) {
condition
variable
  1 open
doSomething
() ;
function
  ;
}  
close  

 

==
Double= is a comparison operator that checks for general equality
= If we used = the value of the variable will change to the number after the parenthesis
> Greater than
>= Greater or equal than
< Less than
<= Less or equal than
!= Is NOT equal
&& And
|| And or
 
if ((myValue == 1) && (myString =="This") ) {
doSomething () ;
}




You can add else and else if to extend the structure to 2 or 3 different conditions
if
(variable operator number) {
condition
variable
    open
function1()
;
}
 

 

else if
(variable operator number) {
2nd condition
(description of second condition)
open
function1()
;
}
 

 

else
  {
any other
case open
function3()
;
}
 

if (myValue == 1) {
doSomething() ;
}
if else (myValue >1) {
doSomethingElse() ;
}
else {
doSomethingDifferent();
}