---
title: "Iteration"
canonical: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/Iteration.html"
source: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/Iteration.md"
part: "Sets, Sequences, and Mappings"
chapter: "Lists"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Sets, Sequences, and Mappings", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/index-sets-sequences-mappings.md"}
  - {"title": "Lists", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/index-lists.md"}
prev: {"title": "Assignment Operator", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/assignment.md"}
next: {"title": "Associative Arrays", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/AssociativeArrays/index-associative-arrays.md"}
intrinsics:
  - {"name": "in", "signature": "x in L"}
  - {"name": "in", "signature": "i -> x in L"}
---

# Iteration

Iteration over lists is allowed. Note that, unlike most other iterators, the values returned by iteration over a list may be of differing types.

<a id="literal-literal-in-x-in-l"></a>
## `x in L`

<a id="literal-literal-in-i-x-in-l"></a>
## `i -> x in L`

The identifier $x$ will take on the value of successive elements of the list $L$; if the dual iteration form is used then $i$ will be the corresponding index.
