# Keep a little collection

Store several names and visit each one.

Last updated: 2026-09-09

Package: recipes | Status: complete-program

Tags: cpu, recipe

A list keeps values in order. It is useful for animals, collected items, dialogue lines, or scores. list of text means every entry in this list is text. Square brackets create the list and also let us look up one entry. The first entry has index zero. An index is an entry's position, not the entry itself.

```yh
start.yh
```


## Keep a little collection

Store several names and visit each one.

Verification: type checked

```yh
list of text names = ["Pip", "Fern"]
names.Add("Moss")
for name at index in names
{
    Console.Log(Text.Format("{0}: {1}", index, name))
}
```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.recipe__lists"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Expected output:

```text
0: Pip
1: Fern
2: Moss
```

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/recipe--lists/program --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Add one more name. Swap Pip and Fern in the starting list. Notice that order and count are different ideas.

Source: demonhunterlabs/app/lib/yeho-walkthrough.ts

AI training permission: https://demonhunterlabs.com/ai-use
