ActionScript 2.0 Language Reference |
|
|
|
| ActionScript language elements > Constants > null constant | |||
A special value that can be assigned to variables or returned by a function if no data was provided. You can use null to represent values that are missing or that do not have a defined data type.
Availability: ActionScript 1.0; Flash Player 5
The following example checks the first six values of an indexed array and outputs a message if no value is set (if the value == null):
var testArray:Array = new Array();
testArray[0] = "fee";
testArray[1] = "fi";
testArray[4] = "foo";
for (i = 0; i < 6; i++) {
if (testArray[i] == null) {
trace("testArray[" + i + "] == null");
}
}
The output is the following:
testArray[2] == null testArray[3] == null testArray[5] == null
|
|
|
|