Positional vs. Named Parameter Notation v12
You can use either positional or named parameter notation when passing parameters to a function or procedure. If you specify parameters using positional notation, you must list the parameters in the order that they are declared; if you specify parameters with named notation, the order of the parameters is not significant.
To specify parameters using named notation, list the name of each parameter followed by an arrow (=>)
and the parameter value. Named notation is more verbose, but makes your code easier to read and maintain.
A simple example that demonstrates using positional and named parameter notation follows:
To call the procedure using positional notation, pass the following:
To call the procedure using named notation, pass the following:
Using named notation can alleviate the need to re-arrange a procedure’s parameter list if the parameter list changes, if the parameters are reordered or if a new optional parameter is added.
In a case where you have a default value for an argument and the argument is not a trailing argument, you must use named notation to call the procedure or function. The following case demonstrates a procedure with two, leading, default arguments.
You can only omit non-trailing argument values (when you call this procedure) by using named notation; when using positional notation, only trailing arguments are allowed to default. You can call this procedure with the following arguments:
You can use a combination of positional and named notation (mixed notation) to specify parameters. A simple example that demonstrates using mixed parameter notation follows:
You can call the procedure using mixed notation:
If you do use mixed notation, remember that named arguments cannot precede positional arguments.