Set item at index
setitem index collection expression
set index collection expression
item index collection := expression
ref collection index := expression
collection,index := expression
Set the new value of item at specified index in the collection to the result of expression.
POOL and some other LOGO dialects allow to modify items in arrays (in contrast to list items and word characters,
which are immutable). Traditional LOGO instruction for this purpose is setitem
,
but it is quite a verbose. In POOL you can use more compact syntax with the assignment operator :=
.
Example:
make "a {1 2 3}
set 1 :a "x
print :a
:a,2 := "y
print :a
Output:
{x 2 3}
{x y 3}
See also:
item, ref, operator , - item at index
Array
Table of Content