---
title: "Assignment Operator"
canonical: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/assignment.html"
source: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/assignment.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": "Access Functions", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/access.md"}
next: {"title": "Iteration", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Lists/Iteration.md"}
intrinsics:
  - {"name": "S[i] := x", "signature": "S[i] := x: List, RngIntElt, Elt"}
---

# Assignment Operator

<a id="literal-literal-s-i-x-list-rngintelt-elt"></a>
## `S[i] := x: List, RngIntElt, Elt`

Redefine the $i$-th term of the list $S$ to be $x$. If $i \leq 0$, then an error results. If $i = \#S + 1$, then $x$ is appended to $S$. Otherwise, if $i > \#S + 1$, an error results. Here $i$ is allowed to be a multi-index.
