Data is how a program remembers the shape of the world. A receipt has a table number and a total. A ticket has a seat. A route has stops. A payment can be waiting, paid, or failed.
Musi gives these shapes names. Records hold fields. Arrays hold ordered values. data gives a type a set of cases. match opens those cases safely.
This part uses small real examples. You will see records, arrays, fields, index access, option values, result values, and patterns.
The goal is simple: make data forms easy to see in code.
Chapters
Data
Chapter»RecordsA record keeps related values together and names each field.Chapter»Arrays and slicesArrays keep values in order. Slices let code talk about part of that order.Chapter»Data definitions
data creates a type-shaped value. Variants use |. Record fields use ;.Chapter»Indexing and fieldsDot access reads a field. Indexed access reads by position.Chapter»Option and resultOption means value or no value. Result means success or error.Chapter»PatternsPatterns let match read variants, fields, and simple values.