Passing arrays

When an argument is an array, you specify brackets as part of the argument name in the declaration for the function or event.

Variable-size array as an argument

For example, suppose a function named uf_convertarray accepts a variable-size array of integers. If the argument’s name is intarray, then for Name enter intarray[ ] and for Type enter integer.

In the script that calls the function, you either declare an array variable or use an instance variable or value that has been passed to you. The declaration of that variable, wherever it is, looks like this:

integer a[]

When you call the function, omit the brackets, because you are passing the whole array. If you specified brackets, you would be passing one value from the array:

uf_convertarray(a)

Fixed-size array as an argument

For comparison, suppose the uf_convertarray function accepts a fixed-size array of integers of 10 elements instead. If the argument’s name is intarray, then for Name enter intarray[10], and for Type enter integer.

The declaration of the variable to be passed looks like this:

integer a[10]

You call the function the same way, without brackets:

uf_convertarray(a)

NoteIf the array dimensions do not match If the dimensions of the array variable passed do not match the dimensions declared for the array argument, then array-to-array assignment rules apply. For more information, see “Declaring arrays”.