up previous next
1.5.2 Assignment
An assignment command has the form
  L := E
where L is a variable and E is an expression. The assignment command binds the result of the evaluation of the expression E to L in the working memory.

Example
/**/  M := 5;  N := 8;
/**/  T := M+N;
/**/  println T;
13
/**/  T := T+1;  -- evaluate RHS first, then assign value to T
/**/  println T;
14

/**/  L := [1,2,3];
/**/  L[2] := 0; -- assign to an entry in a list
/**/  println L;
[1, 0, 3]

/**/  P := record[F := x*z];
/**/  P.Degree := deg(P.F); -- assign to a field in a record
/**/  P;
record[Degree := 2, F := x*z]