Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning value to an array
Message
De
04/04/2000 21:52:10
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
04/04/2000 21:40:44
Ian Johnston
Computer Software Solutions
Woodland, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00355436
Message ID:
00355443
Vues:
21
>What is the syntax for returning a value from an array in a function to an array and will it automatically dimension the array it is returning to ?

Arrays are never automatically redimensioned by assigning a value to them.

If you really mean return one element, then the assignment syntax is the same as any other assignment to an array.
LOCAL laArr[1]
laArr[1] = myFunction()

FUNCTION myFunction
LOCAL laArr[1]
laArr[1] = 'Hello'
laArr[2] = 'Goodbye'
RETURN laArr[2]
If, OTOH, you want to return an _array_ (not just an element), the pass the array to the function, like so:
LOCAL laArr[1]
myFunction(@laArr)

FUNCTION myFunction
LPARAMETER taArr
DIMENSION taArr[2]
taArr[1] = 'Hello'
taArr[2] = 'Goodbye'
RETURN
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform