Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing and returning arrays
Message
 
 
À
18/03/2002 17:54:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00633588
Message ID:
00634288
Vues:
20
>>>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
>>
>
>Not true! The array doesn't even have to exist BEFORE you call the object's method. It will be created within the scope of the calling code as a local variable.

I was talking about PRG based function.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform