Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Procedure or Function? Warning - lStupidQuestionFlag=.T.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00360281
Message ID:
00360301
Vues:
13
>>Or perhaps it's that traditionally a function returns a value, whilst a procedure does not.
>
>Traditionally, that is the case. However, in VFP it doesn't make any difference how they are defined...it's how they are called. For example:
>
>
>PROCEDURE MyRoutine
>LPARAMETERS a, b
>* Do something
>RETURN "Completed"
>

>
>Now, if I use the following code:
>
>
>DO MyRoutine WITH 1, 2
>

>
>It is treated as a procedure. The return value is not used. However, I can also call the same routine as a function:
>
>
>c = MyRoutine(1, 2)
>


Hiya Craig,

While VFP doesn't differentiate between the two, I'd say that when you're returning a value, call it a FUNCTION and if not call a PROCEDURE. This not only is consistent with other languages (where the two aren't interchangable), but, I believe, adds to the readability.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform