Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning an Array from a Function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00338850
Message ID:
00339197
Vues:
39
>>You also cannot use the @ within a return, and can't pass something created as LOCAL or PRIVATE up the chain; only PUBLICs can be seen above the level at whichthey are created.
>
>Not sure that I'm reading this correctly, but just to be clear: You *can* return a value created as LOCAL or PRIVATE.
>
>For example:
>
>function DivideByTwo
>lparameter lSomeValue
>local lReturnVal
>lReturnVal = lSomeValue / 2
>return lReturnVal
>

Sorry, I did not explain this further, you must make an explicit return; changes do not propagate upwards if pass by value, and variables created in the function or method do not survive the termination of the function or method. An object created in LOCAL or PRIVATE context, whose reference is explicitly returned and where that return value is explicitly assigned to a memvar will survive the termination of the original function, because an instance of the object reference continues to exist. If you do not explicitly assign the object ref returned to a memvar (or a member property of another object whose existance extends beyond the life of the call) then the object terminates.

In case you're wondering, a modeless Form created in the context of a procedure, method or function without the LINKED clause continues to exist because an object reference to it is implicitly created in the _Screen.Forms collection; have I omitted any circumstances that might otherwise be significant here?

>
>Take care,
>Joe
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform