7.2 Variable types

All variables can have a type. A type annotation on a variable definition limits the set of values that can be stored in that variable. A type annotation must be a compile-time constant expression that evaluates to a class or interface value. The actual value used to represent the type of the variable is the instance traits of the referenced class or interface.

When a value is assigned to a variable, an implicit conversion to the variable's type is performed on the value. A type error occurs if there is no implicit conversion of that value to the variable's type. In the strict dialect, such errors are verification errors; in the standard dialect, type errors are runtime errors.

If no type is specified, or if the wildcard annotation * is specified (as in var x : *), the variable is said to be untyped.


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification64.html