1.5.2 Assignment |
L := Ewhere 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] /**/ use QQ[x,y,z]; /**/ P := record[F := x*z]; /**/ P.Degree := deg(P.F); -- assign to a field in a record /**/ P; record[Degree := 2, F := x*z] |