## Parameters and arguments

The terms parameter and argument are not synonymous. A parameter is the term that is used to describe the form of data items associated with a function declaration. For example, in Function doubleValue (anyNumber As Integer), anyNumber is a parameter, because it tells the function what form the data that is being passed into it will take: in this case integer. The value used in place of the parameter when we make the function call is called an argument. In this example, i.e., doubleValue (12) then the argument is the integer 12. One can think of a parameter as a variable and an argument the value that the variable takes in a specific situation.

This simple example function is called doubleValue - for its purpose is to double any integer value. Before writing the code, note the following:

♦ There will b e one parameter associated with this function, and that parameter - called AnyNumber - will be of integer data type. Within the function, AnyNumber is used as if it where a normal variable.

♦ The type of the value to be returned will be an integer. Notice how the data type to be returned is given after the argument declaration in parentheses.

♦ The function is being named doubleValue, and the function will take the value of the argument being passed to it, and multiply it by two.

Function doubleValue(AnyNumber As Integer) As Integer doubleValue = AnyNumber * 2 End Function

0 0