[Next][Prev] [_____] [Left] [Up] [Index] [Root]

Iteration

v in A
k -> v in A
Iteration over the values in an associative array is supported as usual; in the forms above, v will take the value of successive elements in the associative array. If the dual iteration form is used then additionally k will take on the value of the associated key.

Example Assoc_AssocIteration (H13E2)

We revisit the first part of the above example and print the elements out using the dual iteration.

> A := AssociativeArray();
> A[1/2] := 7;             
> A[3/8] := "abc";
> A[3] := 3/8;
> for k -> v in A do k, v; end for;
1/2 7
3/8 abc
3 3/8
 [Next][Prev] [_____] [Left] [Up] [Index] [Root]

Version: V2.25 of Tue Dec 3 10:52:18 AEDT 2019