---
title: "Iteration"
canonical: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/Iteration.html"
source: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/Iteration.md"
part: "Sets, Sequences, and Mappings"
chapter: "Tuples and Cartesian Products"
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": "Tuples and Cartesian Products", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/index-tuples-cartesian-products.md"}
prev: {"title": "Equality", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/Boolean.md"}
next: {"title": "Other Operations", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/Other.md"}
intrinsics:
  - {"name": "in", "signature": "x in T"}
  - {"name": "in", "signature": "i -> x in T"}
---

# Iteration

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

<a id="literal-literal-in-x-in-t"></a>
## `x in T`

<a id="literal-literal-in-i-x-in-t"></a>
## `i -> x in T`

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