---
title: "Creating a Record"
canonical: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Records/creation-record.html"
source: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Records/creation-record.md"
part: "Sets, Sequences, and Mappings"
chapter: "Records"
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": "Records", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Records/index-records.md"}
prev: {"title": "The Record Format Constructor", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Records/creation-format.md"}
next: {"title": "Access and Modification Functions", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Records/access-modification.md"}
intrinsics:
  - {"name": "rec", "signature": "rec< F | L >: RecFormat, FieldAssignmentList -> Rec"}
examples:
  - "ex-648bdd"
---

# Creating a Record

Before a record is created, its record format must be defined. A record may be created by assigning as few or as many of the record fields as desired.

<a id="constructor-constructor-rec-recformat-fieldassignmentlist-rec"></a>
## `rec< F | L >: RecFormat, FieldAssignmentList -> Rec`

Given a record format $F$, construct the record format corresponding to the field assignment list $L$. Each term of $L$ must be of the form $fieldname\ {:}= expression$ where $fieldname$ is in $F$ and the value of the expression conforms (directly or by coercion) to any restriction on it. The list $L$ may be empty, and there is no fixed order for the fieldnames.

<a id="example-ex-648bdd"></a>
## `Example: Building Records (ex-648bdd)`

We build some records having the record format `RF`.

```magma
> RF := recformat< n : Integers(), misc, seq : SeqEnum >;
> r := rec< RF | >;
> r;
rec<RF | >
> s := rec< RF | misc := "adsifaj", n := 42, seq := [ GF(13) | 4, 8, 1 ]>;
> s;
rec<RF | n := 42, misc := adsifaj, seq := [ 4, 8, 1 ]>
> t := rec< RF | seq := [ 4.7, 1.9 ], n := 51/3 >;
> t;
rec<RF | n := 17, seq := [ 4.7, 1.9 ]>
> u := rec< RF | misc := RModule(PolynomialRing(Integers(7)), 4) >;
> u;
rec<RF | misc := RModule of dimension 4 with base ring Univariate Polynomial
Algebra over Integers(7)>
```
