# loop

Repeat until explicitly ended

Last updated: 2026-09-09

Package: language | Status: stable

Tags: cpu, keyword, language, loops, yeho

Use loop for event pumps or retry flows with clear exit points. Use while when one condition explains the whole lifetime.

```yh
loop
```


## Controlled indefinite loop

Use loop for event pumps or retry flows with clear exit points. Use while when one condition explains the whole lifetime.

Verification: type checked

```yh
int attempt = 0
loop
{
    attempt = attempt + 1
    if attempt < 3 { next }
    Console.Log("Connected")
    end
}

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.word__loop"
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/word--loop/complete-0 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


next and end target the nearest active loop.

The historical endLoops token is not supported.

Source: yeho/parser_statements.cpp parseLoopStatement and parseLoopControlStatement

AI training permission: https://demonhunterlabs.com/ai-use
