When verbally talking about methods, I\'m never sure whether to use the word argument or parameter or something else. Either way the other people know what
The parameters of a function/method describe to you the values that it uses to calculate its result.
The arguments of a function are the values assigned to these parameters during a particular call of the function/method.
A parameter is something you have to fill in when you call a function. What you put in it is the argument.
Simply set: the argument goes into the parameter, an argument is the value of the parameter.
A bit more info on: http://en.wikipedia.org/wiki/Parameter_(computer_science)#Parameters_and_arguments
Parameter is a variable in a function definition
Argument is a value of parameter
<?php
/* define function */
function myFunction($parameter1, $parameter2)
{
echo "This is value of paramater 1: {$parameter1} <br />";
echo "This is value of paramater 2: {$parameter2} <br />";
}
/* call function with arguments*/
myFunction(1, 2);
?>
Or may be its even simpler to remember like this, in case of optional arguments for a method:
public void Method(string parameter = "argument")
{
}
parameter
is the parameter, its value, "argument"
is the argument :)
Parameters and Arguments
All the different terms that have to do with parameters and arguments can be confusing. However, if you keep a few simple points in mind, you will be able to easily handle these terms.
- The formal parameters for a function are listed in the function declaration and are used in the body of the function definition. A formal parameter (of any sort) is a kind of blank or placeholder that is filled in with something when the function is called.
- An argument is something that is used to fill in a formal parameter. When you write down a function call, the arguments are listed in parentheses after the function name. When the function call is executed, the arguments are plugged in for the formal parameters.
- The terms call-by-value and call-by-reference refer to the mechanism that is used in the plugging-in process. In the call-by-value method only the value of the argument is used. In this call-by-value mechanism, the formal parameter is a local variable that is initialized to the value of the corresponding argument. In the call-by-reference mechanism the argument is a variable and the entire variable is used. In the call- by-reference mechanism the argument variable is substituted for the formal parameter so that any change that is made to the formal parameter is actually made to the argument variable.
Source: Absolute C++, Walter Savitch
That is,
Oracle's Java tutorials define this distinction thusly: "Parameters refers to the list of variables in a method declaration. Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the arguments used must match the declaration's parameters in type and order."
A more detailed discussion of parameters and arguments: https://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html