contents.gifprev1.gifnext1.gif

Variables

A nu/TPU variable is any valid nu/TPU identifier that is not a reserved word or a constant. Variables can be either LOCAL or GLOBAL. Any variables not defined within a local statement within a user procedure definition are considered global in scope. Global variables are available for the entire nu/TPU session. Local variables are only available in the procedure in which they are declared. If a local variable is declared with the same name as a global variable, the local variable will supersede (or occlude) the global variable.

nu/TPU uses variables to hold values. The types of variables available in nu/TPU are described in the section on data types.

Each variable in nu/TPU can store an individual value. The only exception to this is the ARRAY data type. Array variables can hold any of the other data types.

nu/TPU stores variables dynamically. Space is allocated and reserved for individual variables as they are created and released when those same variables are destroyed.

The only restriction on variable naming is that all variable names must be valid nu/TPU identifiers.

The first character of the identifier must be an alpha character (a-z or A-Z). Any of the other characters can be alphanumeric (A-z, 0-9), including the dollar sign ($) and underscore (_). Valid identifiers can be up to 32 characters in length. Also, variables are assigned a data type when they are created. The individual variable’s data type being assigned is based on the value given the variable.

Data types define the variable declarations which are allowed in nu/TPU. Any given variable can be any one of the listed data types. The only exception to this is the ARRAY variable type. A single array variable can hold any of the other variable types as separate elements in the array.