Parameters are a type of variable used in a subroutine to refer to the data provided as input to the subroutine.
A parameter is an intrinsic property of a procedure, included in its definition. For example, in many languages, a minimal procedure to add two supplied integers together and calculate the sum total would need two parameters, one for each integer. In general, a procedure may be defined with any number of parameters, or no parameters at all. If a procedure has parameters, the part of its definition that specifies the parameters is called its parameter list.
There are two ways of passing parameters to a procedure (both of them may not be available in every programming language):
- by value: the value of a variable (or constant, etc.) is passed to the procedure and the original variable cannot be affected by the code in the procedure.
- by reference: the reference to a variable is passed to a procedure and the variable's value can be changed in the procedure.