Cairo course

Cairo Level 2: Data Structures

Data Structures is level 2 of 14 of the LoWisa Cairo course. It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

Updated 2026-11-30

Structs and Enums

  • Structs. A struct groups named fields: instantiated by name, destructured by pattern.
  • Enums. An enum declares variants that may carry data: Option and Result are enums like yours.
  • Generic types. Types take generic parameters: Wallet<T>: checked at compile time.

Pattern Matching

  • match exhaustively. match handles every variant or fails to compile: the missing case is an error, forever.
  • Destructuring. Patterns destructure structs and enums: fields bound as they match.
  • Options and results. Option and Result are matched, mapped and propagated: absence and failure as values.

Collections

  • Arrays. A Cairo array is append-only: written once, read by index, the prover-friendly sequence.
  • Felt252Dict. The dictionary type gives key-value storage in memory: squashed and verified at run’s end.
  • Spans. A span is a read-only view over an array: passing data without copying it.

Before and after this level

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.

Frequently asked questions

What does Cairo Level 2: Data Structures cover?

Structs and Enums, Pattern Matching, Collections: 3 lessons and 9 ideas.

What should I know before this level?

The level before it, Level 1: Cairo Foundations, which covers Values and Types, Functions, Control Flow.

Learn Cairo on your phone

The first level is free. LoWisa is on Google Play and the App Store.