next up previous contents
Next: The choose Statement Up: Statements Previous: The assert Statement   Contents

The Assignment

$$ Assignment ::= Variable {"." Value} 
$$                (":=" | ":=+" | ":=-" | ":=*" | ":=/") Expression ";" .

To set the value of an already defined variable to a different value, use a statement of the following form:

$var := expr;
The expression expr is evaluated and the result is assigned to the variable $var. The variable must have already been defined.

You can optionally specify a path behind the variable that is to be set by an assignment:

$var.part1.part2 := value;
In this case, only the value of ``$var.part1. part2'' will be set to value; the remainder of the variable $var will be unchanged. Each part must be an expression that evaluates to a symbol, a number or a list of symbols and numbers.

You can also use one of four other assignment operators instead of the operator ``:='': The statement ``$var :=+ value;'' is a shorthand for ``$var := $var + value;'', the analogon holds for the assignment operators ``:=-'', ``:=*'', and ``:=/''. Here, $var may be followed by a path again.



Bjoern Beutel