Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RETURN does arrays!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00570900
Message ID:
00570925
Vues:
23
>>I didn't notice this in the "New....." section or the "Enhancements..." section of the VFP7 documentation, nor does the RETURN Command write-up mention it, so I thought I'd mention it here as it seems quite important to me.
>>
>>An array can be specified as eExpression of a RETURN command provided that:
>>1) the array was passed by reference into the function in the first place;
>>2) the array is still in scope when the RETURN executes.
>>
>>Found this reading "What's New in Visual FoxPro 7.0" from Hentzenwerkes.
>
>Yes, it does work, but probably not like most folks would like. Try the following:
FUNCTION ArrayTest
>  LPARAMETER ta_foo
>
>  EXTERNAL ARRAY ta_foo
>  DIMENSION ta_foo[2]
>  ta_foo[1] = "A"
>  ta_foo[2] = "B"
>  RETURN ta_foo
>ENDFUNC
>
>DIMENSION a_foo[1]
>a_foo = NULL
>a_foo = ArrayTest(@a_foo)
>DISPLAY MEMORY LIKE a_foo
You'll see that the array is re-dimensioned but the values in both elements are the same. I also tried this with numbers.

It only works when the array is a property of an object. The RETURN in this case is retuning the first element.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform