Programming basics

Operators

To perform arithmetic and logical operations you may use one of numerous operators available in ActionScript.

Some of them are quite traditional like

+ , - , / , *

for arithmetic,

=

assigns right side value to left side variable.

= =

is conditional operator. In

a == b

statement if a equal b result is true, otherwise is false. Other conditional operators are

!= , > , >= , < , <=

- not equal, more, more or equal, less, less or equal.

+=

adds one value to another – for example

varA += varB

++

increments the value of the variable. For example

varA++

yields 7 if previously it was 6.

Also such operators like logical AND

&&

and logical OR

| | .

are used to deside if both conditions are true or if at least one condtion is true.

Parenthesis

( )

are used to structurize equations.

You will easily understand now such example of ActionScript code. Take into account operator precedence - it's the same as for arithmetic.

varA = varC +( 120.3 / varB++ );

Next