Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
More then one variable in a return command
Message
De
09/07/2000 18:01:46
 
 
À
09/07/2000 13:58:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00389980
Message ID:
00390029
Vues:
10
>If I want to send 2 variables by value and return 2 variables by reference how would i do that.
>

You would pass 4 parameters to the function call, two by reference. A simple example. Parms passed by reference can be both in and out variables, so it might only need two or three. FWIW, I use parameter objects rather than pass by ref updates; objects result in simpler interfaces, and typically, when I have several values to return, they probably are related. I use pass by reference mainly for sending arrays to my functions, and for recursion.

LOCAL Var1, Var2, Var3, Var4
STORE 'Init' TO Var1, Var2, Var3, Var4
? 'Start',Var1,Var2,Var3,Var4
=DemoPass(Var1,@Var2,Var3,@Var4) && parms 2 and 4 pass by ref
? 'After 1st call',Var1,Var2,Var3,Var4 && Var4 changed by function
=DemoPass(Var1,Var2,@Var3,@Var4) && parms 3 and 4 pass by ref
? 'After 2nd call',Var1,Var2,Var3,Var4 && both Var3 and Var4 changed by function

FUNCTION DemoPass
LPARAMETERS Parm1, Parm2, Parm3, Parm4
* Alter the values of the 3rd and 4th parm to demo pass by ref
Parm3 = 'New' + Parm3
Parm4 = 'New' + Parm4
RETURN
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
Répondre
Fil
Voir

Click here to load this message in the networking platform