Variables
Top  Previous  Next


Variable is a named storage location that can contain data that can be modified during program execution. Each variable has a name that uniquely identifies it within its level of scope.

Variable names must adhere to the following conventions:

The first character of the name must be a letter (A through Z or a through z).  
Subsequent characters can be any combination of letters (A through Z or a through z), numbers (0 through 9) or the underscore ( _ ) character.  
The name must not be a reserved word. Reserved words include ImageWarp function names and built-in keywords.  
The name must not be longer than 128 characters.  
Names cannot be made unique by case -- the name "XSize" describes the same variable as "xsize" and "XSIZE".  
 
Variables have two scopes: global and local. If a variable is declared outside of any function or subroutine definition, it is a global variable, and its value is accessible and modifiable throughout the script. If a variable is declared inside of a function or subroutine definition, that variable is local. It is created and destroyed every time the function is executed; it cannot be accessed by anything outside the function.

Variables can contain data of the following types:
 
Integer

Used to hold large, nonfractional numeric values (integers), ranging from -2,147,483,648 to +2,147,483,647. An integer value is stored as a 32-bit signed number, occupying 4 bytes of storage.  
 
floating

Used to hold numeric values that include fractional values, ranging from -3.402823E+38 to -1.401298E-45 (for negative numbers) and +1.401298E-45 to +3.402823E+38 (for positive numbers). Floating data types represent single-precision, floating-point values. A floating value is stored in three parts: the sign, the exponent and the mantissa. It requires 4 bytes of storage.  
 
string

Used to hold character data (e.g., letters, digits and punctuation). Internally, a string's storage requirements are the length of the string plus four bytes. Strings may contain up to 65,000 characters. ImageWarp's string data is interpreted according to the ANSI character set .  
 
A variable declared with the Dim statement cannot change its type, while a non-declared variable can change its type during the execution.