contents   index   previous   next



Variables

 

A variable is an identifier to which data may be assigned. Variables are used to store and represent information in a script. Variables may change their values, but literals may not. For example, if programmers want to display a name literally, they must use something like the following fragment multiple times.

 

Screen.writeln("Rumpelstiltskin Henry Constantinople")

 

But they could use a variable to make their task easier, as in the following.

 

var Name = "Rumpelstiltskin Henry Constantinople"

Screen.write(Name)

 

Then they can use shorter lines of code for display and use the same lines of code repeatedly by simply changing the contents of the variable Name.

 


Variable scope