Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return an array from a program
Message
From
29/12/2003 11:28:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
29/12/2003 11:00:55
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00862520
Message ID:
00862534
Views:
11
>How do I return an array from a program, as opposed to returning just the first element of that array?

You can't unless you initialized and passed an array to function to operate on or it's an object method.
However a program could return you an object and an object could have properties including an array property. ie:
clear
LOCAL loRet
loRet = RetMeArrays()
LOCAL ARRAY arr1[1],arr2[1]
ACOPY(loRet.arr1,arr1)
ACOPY(loRet.arr2,arr2)
DISPLAY MEMORY LIKE arr1
DISPLAY MEMORY LIKE arr2


FUNCTION RetMeArrays
LOCAL loObj
loObj = CREATEOBJECT('Empty')
ADDPROPERTY(loObj,'arr1[5,3]')
ADDPROPERTY(loObj,'arr2[5,3]')
FOR ix=1 TO 5
  FOR jx=1 TO 3
     loObj.arr1[ix,jx] = ix*jx
     loObj.arr2[ix,jx] = ix+jx
  ENDFOR
ENDFOR
RETURN loObj
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform