Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return an array from a program
Message
De
29/12/2003 11:28:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/12/2003 11:00:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00862520
Message ID:
00862534
Vues:
10
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform