Wednesday, March 30, 2011

AutoIT Constants and Arrays

Constants

 A constant is a variable that never changes. It remains a static value for the entire
script execution. You cannot change the value of a constant, nor can you convert
an existing variable into a constant. Placing Const after Dim, Global or Local makes
the variable a constant. You can also declare a constant variable without explicit
declaration. The following example illustrates how to declare a constant variable
in each scenario:

Code:
Const $example = 0
Dim Const $example1 = 1
Global Const $example2 = 2
Local Const $example3 = 3
Arrays

 An array is a matrix of data in which all the elements are of the same data type and
size. For example, an array of two numbers—“5” and “3”—is declared as follows:

Code:
$num[0] = "5"
$num[1] = "3"



Figure 1. Visual representation of Example 3. Two-Dimensional Array.
Arrays can also be multidimensional, with up to 64 dimensions. Example 3 shows a two-dimensional array.

1 comment: