Jump to content

Assignment (computer science)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 137.226.36.187 (talk) at 16:21, 19 October 2003. 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)

The assignment operation is one of the basic operations in most imperative computer progrmming languages. It usually takes the form

variable := expression.

The semantics of this operation is that the current state of the executing program is modified:

  • The expression is evaluated in the current state of the program.
  • The variable is assigned the computed value, possibly replacing the prior value of that variable.

Example: Assuming that a is a numeric variable, the assignment a := 2*a means that the content of the variable a is doubled after the execution of the statement.