# 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 Iteration (ex-adf920)`

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

```magma
> 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

```
