# Sets

set of T stores unique typed values and supports membership and explicit mutation.

Last updated: 2026-09-09

Package: language | Status: experimental

Tags: Add, Contains, Remove, collections, count, cpu, language, of, set, yeho

Use a set when membership matters and duplicates do not.

```yh
set of Type
set.Add(value)
set.Contains(value)
set.Remove(value)
```


## Unique membership

Use a set when membership matters and duplicates do not.

Verification: type checked

```yh
set of text badges
badges.Add("builder")
badges.Add("builder")

if badges.Contains("builder")
{
    Console.Log("Badge earned")
}

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.language__sets"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/language--sets/complete-0 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Sets are experimental.

Use list when order or duplicates are meaningful.

Source: yeho/parser_types.cpp parseSetTypeRef; language-core.md §3.4

AI training permission: https://demonhunterlabs.com/ai-use
