| Applying science to business management |
  
Declaring Variables
You must declare a variable before it can be used. You do this
using the var keyword as
follows:
var x;
var radius;
var name;
You can declare more than one variable at a time by listing
more than one variable name in the var
statement.
var x,radius,name;
When a variable is created, it is initially assigned the value
null. You can explicitly assign a different value to the
variable by supplying an initializer in the var statement as follows:
var x=0,radius=23.2;
var name="DScript";
One aspect of DScript that is different from some programming
languages is that you do not declare the type of data the
variable can hold. This is because every variable can hold any
type of data. You can even change the type of data that the
variable holds from one statement to the next. For example, you
can assign a number to a variable in one statement and then later
change the variables
value to a text string.
var x; // declare
variable x
x=5; // x holds
numeric data
x="some text"; // x
data type changed to text
|