0Pricing
Mojo Academy · Lesson

Key-Value Data with Dict

Look up values by key.

Look Up by Key

When you want to find a value by a name instead of a position, use a Dict. It maps keys to values. 🔑

Two Types in Brackets

A Dict declares two types: the key type and the value type, like Dict[String, Int].

var ages = Dict[String, Int]()

All lessons in this course

  1. Building and Growing a List
  2. Key-Value Data with Dict
  3. Unique Items with Set
  4. Choosing the Right Collection
← Back to Mojo Academy