Parameter (computer science)
Categories: Cleanup from February 2005 | Articles to be merged | Computer science
Parameters are values passed into a subroutine designated by the programmer. Most programming languages allow for an infinite number of parameters, and the parameters that will be accepted by a subroutine are defined when the subroutine is written. It is common that when the parameters are defined, they are also given a type (primitive, or object).
The act of passing in a value as a parameter is known as parameter passing.
Sometimes, it is desireable to have one function to be able to take in different series of parameters. When a function with the same name can accept different parameters, it is said to be overloaded. For example, a subroutine might construct an object that will accept directions, and trace it's path to these points on screen. There are a plethora of parameters that could be passed in to the constructor (colour of the trace, starting x and y co-ordinates, trace speed). If the programmer wanted the constructor to be able to accept only the color parameter, then he could call another constructor that accepts only color, which in turn calls the constructor with all the parameters passing in a set of "default values" for all the other parameters (X and Y would generally be centered on screen or placed at the origin, and the speed would be set to another value of the coder's choosing).
See also: Free variables and bound variablescs:Parametr funkce de:Parameter (Informatik) ja:引数