Constants in ActionScript

Notes:

Constants in ActionScript Programming Language:

Variables Vs. Constants in Action Script - Part 2

Syntax:
var nameOfVariable:datatype; // declaration of a variable
nameOfVariable = value; // initialization of a variable

const NAME_OF_CONSTANT:datatype; // declaration of a constant ( lead to a warning)
NAME_OF_CONSTANT=value; // initialization of a constant (lead to an error)

Note: By default the value of a variable or a constant, depends up on the type of a variable or constant.
Always initialize a constant when it is declared.

var nameOfVariable:datatype = value; // declaration and initialization of a variable

const NAME_OF_CONSTANT:datatype = value; // declaration and initialization of a constant

var nameOfVariable1:datatype, nameOfVariable2:datatype,...; // declaration of multiple variables
nameOfVariable1 = value; // initialization of a variable
nameOfVariable2 = value; // initialization of a variable

// declaration and initialization of multiple variables
var nameOfVariable1:datatype = value, nameOfVariable2:datatype = value,…;

// declaration and initialization of multiple constants
const NAME_OF_CONSTANT1:datatype=value, NAME_OF_CONSTANT2:datatype=value,...;

Example Code:
var playerScore:int=10;
trace(playerScore);//10

const PI:Number=3.142;
trace(PI);//3.142

var player1Health:int=100,player2Health:int=100;
trace("player1Health=",player1Health);//100
trace("player2Health=",player2Health);//100

const SCREEN_WIDTH:int=800,SCREEN_HEIGHT:int=600;
trace("SCREEN_WIDTH=",SCREEN_WIDTH);//800
trace("SCREEN_HEIGHT=",SCREEN_HEIGHT);//600