Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing and returning arrays
Message
From
19/03/2002 14:01:04
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00633588
Message ID:
00634587
Views:
18
I don't have VFP7 so I can't test for answer to my question.

After you run myFunc(), are aTemp and aTest separate arrays or separate references to the same array? In case I've phrased that badly, if you modify an element of aTemp, will that have any affect on aTest and vice-versa?

Thanks.....Rich

>>In VFP7, you can return an object's array from an object's method, but you can't do that from a plain old .PRG style function.
>
>You can but such arrays must be in scope after the call. The only way to achive that is to use PUBLIC array. Here's a code
PUBLIC aTest[1]
>aTemp = myFunc()
>?aTemp[1], aTemp[2], aTemp[3], aTemp[4], aTemp[5]
>
>FUNCTION myFunc
>DIMENSION aTest[5]
>aTest[1] = "Some"
>aTest[2] = " values"
>aTest[3] = " can"
>aTest[4] = " be"
>aTest[5] = " returned"
>RETURN @aTest
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform