Jump to content

Parameter (computer programming)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by TakuyaMurata (talk | contribs) at 00:45, 22 September 2003 (splited off from parameter). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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:

  1. Take an object.
  2. Break it into little pieces.
  3. 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:

  1. Destroy rock.
  2. Destroy cake.
  3. 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.