Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning an Array from a Function
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00050449
Message ID:
00050456
Views:
20
>Is it possible to return an array from a function? I have run a few tests that don't seem to be working unless I am missing something. I have a test function that returns an array with 10 elements each element is numbered 1 through 10. And then each element of the local array that is assigned the value from the test function is assigned the value of 1, or whatever value the first element of the array in the function is, rather than the values 1 through 10.
>
>Any ideas? or Can this be done?
>
>Thanks

Paul,

By definition (CS type definition, that is), functions only return a single value. You can, however, create a procedure that will do things like load an array with values. Remember that if you use the DO...WITH syntax, the array will automatically be passed by reference. If you pass it with = SomeFunc() or SomeObj.SomeMeth(), be sure to preceed the variable name with the @ symbol to pass it by reference. Otherwise, the program won't recognize it as an array.

George
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform