Procedure Parameters and Arguments

Frequently a procedure must get some information about the conditions that caused it to run. A procedure that does a task again and again uses different information each time. This information includes variables, constants, and expressions that you pass to the procedure when you call it.

A parameter is a value that the procedure must have, usually supplied when you call it. The declaration of a procedure includes its parameters.

You can declare a procedure with no parameters, one parameter, or more than one. The part of the procedure declaration that gives the parameters is known as the parameter list.

An argument is the value that you supply to a procedure parameter when you call the procedure. The caller supplies the arguments when it calls the procedure. The part of the procedure call that gives the arguments is known as the argument list.


' Declare some variables.
Var x, y, z As Real64

' Call 1: argument is a literal.
x = SquareRoot(1296.0)

' Call 2: argument is a variable.
y = SquareRoot(x)

' Call 3: argument is an expression.
z = SquareRoot(x + y)

Function SquareRoot(number As Real64) As Real64
    ' SquareRoot is the name of the procedure.
    ' number is the only parameter.
    ' SquareRoot also holds the return value.
    SquareRoot = number ^ 0.5
End Function

Parameter data type


Type parameters


See also