GET Function

Retrieves the value of the specified item within an array. The returned value is the value of the array.

Category: Array
Returned data type: Integer

Syntax

array name.GET(<n>)

Required Argument

array name

is the name of the array that you declared earlier in the process.

Optional Argument

n

is the index of the array element for which the content is retrieved. This can be specified as a numeric constant, field name, or expression.

Details

The GET function returns the value of a particular element in the array.

Examples

Example 1

// Declare the string array "string_list" and Integer "i"
string array string_list
integer i
 
// Set the dimension of string_list array to 5 and initialize the counter (i) to 1
string_list.dim(5)
i=1
 
// Set and print each entry in the array, incrementing the counter by 1
while(i<=5)
begin
   string_list.set(i,"Hello")
   print(string_list.get(i))
   i=i+1
end

Example 2

string array string_list
integer i
 
// set the dimension
string_list.dim(5)
i=1 
 
// set and print each entry in the array
while(i<=5)
begin
     string_list.set(i,"Hello")
     print(string_list.get(i))
     i=i+1
end
 
// resize the array to 10
string_list.dim(10)
while(i<=10)
begin
     string_list.set(i,"Goodbye")
     print(string_list.get(i))
     i=i+1
end