User Guide
Operators 189
Operands
expression1 : Number - A number or expression that evaluates to a number.
expression2 : Number - A number or expression that evaluates to a number.
Returns
Number - The result of the arithmetic operation.
Example
The following example uses the subtraction assignment (
-=) operator to subtract 10 from 5
and assign the result to the variable
x:
var x:Number = 5;
var y:Number = 10;
x -= y; trace(x); // output: -5
The following example shows how strings are converted to numbers:
var x:String = "5";
var y:String = "10";
x -= y; trace(x); // output: -5
See also
- subtraction operator
: type operator
[ modifiers ] var variableName : type
function functionName () : type { ... }
function functionName ( parameter1:type , ... , parameterN:type ) [ :type ]{
... }
Used for strict data typing; this operator specifies the variable type, function return type, or
function parameter type. When used in a variable declaration or assignment, this operator
specifies the variable's type; when used in a function declaration or definition, this operator
specifies the function's return type; when used with a function parameter in a function
definition, this operator specifies the variable type expected for that parameter.
Types are a compile-time-only feature. All types are checked at compile time, and errors are
generated when there is a mismatch. Mismatches can occur during assignment operations,
function calls, and class member dereferencing using the dot (
.) operator. To avoid type
mismatch errors, use strict data typing.
Types that you can use include all native object types, classes and interfaces that you define,
and Function and Void. The recognized native types are Boolean, Number, and String. All
built-in classes are also supported as native types.