0Pricing
Mojo Academy · Lesson

Unique Items with Set

Track membership without duplicates.

Track Uniqueness

When you only care whether something is present, not how many times, use a Set. It holds each item once. ✨

One Element Type

A Set takes a single element type in brackets, like Set[Int]. Every member shares that type.

var ids = Set[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