Vanguard Software
Forecasting & Planning Solutions
Home Products Solutions Services Customers Partners Company
 
Applying science to business management

contents.gifindex.gifprev1.gifnext1.gif

var

The var statement is used to declare variables. This statement can be used to declare a single variable using the format

var name ;

It can be used to declare more than one variable at a time using the format

var name1, name2,... ;

And it can be used with initializers to declare and initialize variables in a single statement:

var name=expression;
var name1=expression1,name2=expression2,...;

Here are some examples:

var x;
var name,age;
var name="John",age=5;
var x=0,y=1,z;
var square=x*x;

If you don't specify an initializer, the variable is set equal to null. That is,

var x;

is the same as

var x=null;

Var can also be used inside for and for/in statements as follows:

for(var n=0; n<10; n++);
for(var name in object);

  Demand Planning  |  Financial Forecasting
Forecasting Software  |  Strategic Planning Software  |  Decision Tree Software
Decision Support Software  |  Expert System Software  |  Online Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2011 Vanguard Software Corporation
Print this page   Email this page to a friend