Click to See Complete Forum and Search --> : how to return an array from a function


lcscne
08-02-2004, 01:30 PM
function retArray()

Dim myArray(1)

myArray(0) = "The record you have chosen is "
myArray(1) = "215"

retArray = myArray

end function

Dim recInfo(1)

recInfo = retArray()



Im getting a "Type mismatch" when I try to return an array from a function into a local array as shown. Can anyone direct me to a document or explain to me the proper syntax for a function that returns an array into a local array?

thanks

lcscne
08-02-2004, 02:35 PM
Dim recInfo

recInfo = retArray()


Ok I'm replying to myself in the hopes that this benefits someone else.

In the local script that calls the function: don't declare the variable that will hold the return value as an array as shown. All documentation/examples I found didn't abide by this but it worked for me by not doing so.