|
Variable
declaration
In
NetDecision Script Language, you use variables to temporarily store
values during the execution of an application. Variables have a
name (the word you use to refer to the value the variable contains)
and a data type (which determines the kind of data the variable can
store).
To
declare a variable is to tell the program about it in advance. The
declaration syntax is the following:
TypeName VariableName1, [VariableName2,
…]
Examples:
inti
string str="Hello", my_string
Variables declared within a function
exist only as long as the function is executing. When the function
finishes, the value of the variable disappears. In addition, the
value of a variable in a function is local to that function - that
is, you can't access a variable in one function from another
function. These characteristics allow you to use the same variable
names in different functions without worrying about conflicts or
accidental changes.
A
variable name:
-
Must begin with
a letter.
-
Can not contain
an embedded period.
-
Must not exceed
255 characters.
-
Must be unique
within the same scope, which is the range from which the
variable can be referenced.
Data
Types
| Type Name
|
Type Description
|
| int
|
Integer data consists of numeric data with
precision to a whole number. |
| double
|
Floating point number |
| string
|
Allows manipulation and formatting of text strings
and determination and location of sub-strings within strings. |
| array
|
Multidimensional collection (array) of variables.
For more information, refer to Arrays |
| snmpvar
|
SNMP variable binding. Consists of Object ID,
Object Syntax and Object Value. |
| snmppdu
|
SNMP PDU (Protocol Data Unit) - set of SNMP PDU
parameters plus Variable Binding list |
| xml
|
XML DOM Document node |
| byte
|
The byte type can represent integers in the range
from 0 to 255, inclusive. |
| char
|
The char type is used to store the integer value of
a member of the representable character set. That integer value is
the ASCII code corresponding to the specified character. |
|