BradV
(Seasoned Scripter)
2015-12-15 12:43 PM
dimension array variable

Sorry, this may be a dumb question but my mind just can't seem to find the answer this morning. \:\)

I want to use a UDF which returns an array. The size of the array will vary. How do I declare my variable to hold the returned array with the proper dimensions? If I declare it with length 0, will the function call automatically redim it with the returned array size?


JochenAdministrator
(KiX Supporter)
2015-12-15 12:47 PM
Re: dimension array variable

Brad,

morning .. can't you just assing the array the function returns to a before declared variable (of type variant) ?

Or do I miss something pretty obvious?


BradV
(Seasoned Scripter)
2015-12-15 12:59 PM
Re: dimension array variable

Like:
 Code:
DIM $myArray[]
$myArray=SomeFunction()
?

I think my problem was I thought I had to declare some length, but after your post went back and looked at the manual and it shows a declaration with no length. \:\)


JochenAdministrator
(KiX Supporter)
2015-12-15 01:03 PM
Re: dimension array variable

not even needed imo..

this should work as well:

 Code:
DIM $myArray
$myArray=SomeFunction()
for each $e in $myArray
    $e ?
next


BradV
(Seasoned Scripter)
2015-12-15 01:06 PM
Re: dimension array variable

Ahh! OK. Thanks much! \:\)