>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.
? SphereVolume(3)
function SphereVolume(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.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)