Topic summary
Parameter (computer programming)
In computer programming, a parameter, or formal argument, is a variable that represents an argument to a function call. A function's signature defines its parameters. A call invocation involves evaluating each argument expression of a call and associating the result with the corresponding parameter.
For example, consider the Python function
defadd(x:int,y:int)->int:returnx+yVariables x and y are parameters, each of type int. For call add(2, 3), the expressions 2 and 3 are arguments. For call add(a + 1, b + 2), the arguments are a + 1 and b + 2.
Parameter passing is defined by a programming language. Evaluation strategy defines the semantics for how parameters can be declared and how arguments are passed to a function. Generally, with call by value, a parameter acts like a new, local variable initialized to the value of the argument. If the argument is a variable, the function cannot modify the argument state because the parameter is a copy. With call by reference, which requires the argument to be a variable, the parameter is an alias of the argument.