Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What means parameters
Message
 
 
À
29/04/2007 11:15:41
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01220881
Message ID:
01220950
Vues:
19
>>In my function I got the message missing parameters
>>
>>Then I looked into another function I saw the parameters:
>>
>>*****************************************************************
>>LPARAMETERS tcSource, tcDestination, tcAction, tlUserCanceled
>>*****************************************************************
>>
>>What are parameters ?
>>Are they variables ?
>>
>>Could anybody explain ? because I never used them before
>>
>>Moises
>
>A function or procedure is a bit of code that can be called over and over again, to do some specific task. (FUNCTION and PROCEDURE is the same in VFP.)
>
>A function might require some data to work with. This data is passed through parameters.
>
>Here is a sample function that calculates the volume of a sphere. As data, it requires the radius of the sphere. I am also including a command that calls (or invokes) the function.
>
>
>* Function is called here.
>* The number 3 is passed as a parameter, i.e., as data to the function.
>* The return value of the function is shown on screen - it might
>* also be assigned to a variable, or included in further calculations.
>? SphereVolume(3)
>
>function SphereVolume(tnRadius)
>  return 4 / 3 * pi() * tnRadius ^ 3
>endfunc
>
>* Alternative syntax:
>* function SphereVolume
>*   lparameters tnRadius
>*   return 4/ 3 * pi() * tnRadius ^ 3
>* endfunc
>
>
>In the example:
>
  • 3 is passed as a parameter.
    >
  • The function receives this to the variable tnRadius.
    >
  • The function does some calculations with this value.
    >
  • The function returns a value.
    >
  • The entire function call can be used in more complex expressions, for example: x = SphereVolume(lnRadius) * 10 to get the volume of 10 identical spheres. When using a function this way, the function is evaluated, and the resulting value (the value returned by the function) is replaced in the expression.

    Here is the link I mentioned earlier http://www.berezniker.com/display/VFP/Difference+between+FUNCTION+and+PROCEDURE+statements
    If it's not broken, fix it until it is.


    My Blog
  • Précédent
    Suivant
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform