Parameter (computer programming)
In computer science, parameters are a way of allowing the same sequence of commands to operate on different data without re-specifying the instructions.
For example, take the following list of instructions:
- Take an object.
- Break it into little pieces.
- Throw it away.
In this case, the object that the instructions are to operate on is the parameter. If we give this process a name like Destroy, then referring to Destroy followed by the desired object will perform the actions on that object.
For instance:
- Destroy rock.
- Destroy cake.
- Destroy car.
Will apply the instructions above to a rock, cake, and car respectively.
This notion is useful for both being able to reason about a sequence of processes and effectively programming a computer. Much of the theory of programming languages deals with various method of passing parameters. These include: call-by-value, call-by-reference, call-by-name.