Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function vs Procedure
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00671285
Message ID:
00675184
Vues:
14
Thanks David:
I thought from Jims post that their "behavior" was different. Thats what raised my curiosity!


>Terry,
>
>Not really, a function doesn't have to return anything (although it will return .t. by default). A procedure may or may not return a value. The only way though that the calling code can see either a function or procedure return value is by calling it as a function x = Something(). If it's called as a procedure do Something the returned value goes to the bit bucket.
>
>>Jim
>>What is the difference in behavior: Is it a fuction has to return to caller while a procedure can thread-on-out with out returning?
>>Terry
>>
>>>Sony,
>>>
>>>It is the way you call the code that makes it behave one way or the other, not the way you declare it.
>>>
>>>
>>>FUNCTION Junk
>>>lcVar = "Hello"
>>>RETURN lcVar
>>>ENDFUNC
>>>
>>>PROCEDURE Junk
>>>lcVar = "Hello"
>>>RETURN lcVar
>>>ENDPROC
>>>
>>>
>>>The preceeding are exactly the same ion the way they will behave when called. If you call them with DO ... then they act like procedures and if you call them with Junk() they behave like functions.
>>>
>>>JimB
>>>
>>>>Functions and procedures are similar except in that a procedure does a job and returns and function does the job and returns a value(in theory). However, now they are used interchangeably.
>>>>
>>>>
>>>>Thanks
Imagination is more important than knowledge
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform