Assignment (computer science)
Appearance
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.