Page 1 of 1 1
Topic Options
#210993 - 2015-12-15 12:43 PM dimension array variable
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 681
Loc: Maryland, USA
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?

Top
#210994 - 2015-12-15 12:47 PM Re: dimension array variable [Re: BradV]
Jochen Administrator Online   happy
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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?
_________________________



Top
#210995 - 2015-12-15 12:59 PM Re: dimension array variable [Re: Jochen]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 681
Loc: Maryland, USA
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. \:\)

Top
#210996 - 2015-12-15 01:03 PM Re: dimension array variable [Re: BradV]
Jochen Administrator Online   happy
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
not even needed imo..

this should work as well:

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



Top
#210997 - 2015-12-15 01:06 PM Re: dimension array variable [Re: Jochen]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 681
Loc: Maryland, USA
Ahh! OK. Thanks much! \:\)
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 41 anonymous users online.
Newest Members
LayneSA, Mavack, xiripot, tspirtle, Safio
17719 Registered Users

Generated in 0.039 seconds in which 0.014 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org