#### Using array variables

You can assign values to elements of an array and also use the values of the elements for other computations.

##### Example

    StringVar Array x := ["hello", "bye", "again"];
    x [2] := "once"; //Now x is ["hello", "once", "again"]
    //The expression below would cause an error if not
    //commented out since the array has size 3
    //x [4] := "zap";
    //The formula returns the String "HELLO"
    UpperCase (x [1])

The Redim and Redim Preserve keywords can be used to resize an array if you want to add extra information to it. Redim erases the previous contents of the array first before resizing it whereas Redim Preserve preserves the previous contents.

    Local NumberVar Array x;
    Redim x [2]; //Now x is [0, 0]
    x [2] := 20; //Now x is [0, 20]
    Redim x [3]; //Now x is [0, 0, 0]
    x [3] := 30; //Now x is [0, 0, 30]
    Redim Preserve x [4]; //Now x is [0, 0, 30, 0]
    "finished"
    Local StringVar Array a;
    Redim a [2];
    //Assign a value to the first element of the array a
    a[1] := "good";
    a[2] := "bye";
    //The & operator can be used to concatenate strings
    a[1] & a[2] //The formula returns the String "goodbye"

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com