Vanguard Software
Forecasting & Planning Solutions

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);

  Forecasting Software  |  Strategic Planning Software  |  Decision Support Software
Decision Tree Analysis  |  Monte Carlo Simulation Software  |  Risk Analysis Software
Portfolio Analysis  |  Expert System Software  |  Customer Questionnaires

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2010 Vanguard Software Corporation
Home Products Solutions Services Customers Partners Company
Vanguard
Applying science to business management
Vanguard
Print this page   Email this page to a friend