Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Procedure vs Function
Message
De
21/08/2006 10:27:55
 
 
À
21/08/2006 03:59:00
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01147203
Message ID:
01147289
Vues:
20
Is there any difference in Procedure or Function in a program?

In addition to what the others have said, there is also a difference with respect to how they treat the paramters they are passed. When you call a procedure like this:
DO MyProc WITH MyParam
by default, the parameters are passed by reference. This means that any changes made to them in the called procedure will be seen in the calling procedure. Of course, you can get around this and pass the parameters by value like this:
DO MyProc WITH ( MyParam )
On the other hand, when you call a function, parameters, by default, are passed by value. This means that any changes made in the called function will not be seen in the calling program. Of cource, you can always get around this and explicitly pass the parameters to the function by reference:
luRetVal = CallMyFunction( @param1, @param2 ) 
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform