Previous Up Next

12.2.8  Infixed assignments: => := =<

The infixed operators =>, :=, and =< can all store a value in a variable, but their arguments are in different order. (See Section 5.4.2 and Section 5.4.3.) Also, := and =< have different effects when the first argument is an element of a list stored in a variable, since =< modifies list elements by reference (see section 12.2.10).

Note that multiple assigments can be made using sequences or lists. Both

[a, b, c]:= [1, 2, 3]

and:

(a, b, c):= (1, 2, 3)

assign a the value 1, b the value 2, and c the value 3. If multiple assignments are made this way and variables are on the right hand side, they will be replaced by their values before the assignment. If a contains 5 and you enter:

(a,b):= (2,a)

then b will get the previous value of a, 5, and not the new value of a, 2.


Previous Up Next