Maptitude GISDK Help

How Arrays Work

Arrays are sets of pointers to where values are stored. A dim statement will create a new set of pointers, which point to null. An assignment statement for an array element will set that pointer to a constant, the value of a variable, or another array as a subarray. Changing an array element changes what it points to, not the constant or a variable to which it points. However, a change in a subarray does change the values returned from that subarray:

dim x[2] // x[1] and x[2] both point to null

x[1] = "Caliper" // x[1] now points to the // constant "Caliper"

m = 12 // Create an integer variable and // set it equal to 12

x[2] = m // x[2] now points to the value of m, // the integer constant 12

m = 15 // x[2] does not change

x[2] = x[2] + 2.5 // x[2] now points to the real constant // 14.5, and m still equals 15

z = {1, 2, 3} // Create an array and have z point to it

x[1] = z // x[1] now points to the same array as z

z[3] = 5 // x[1][3] also now equals 5

z = null // x[2] does not change

For more information, see...

Working with Arrays

Options Arrays and Dot Notation

How Arrays Work

Array Methods

 

 

©2025 Caliper Corporation www.caliper.com