# return

Leave a function with an optional value

Last updated: 2026-09-09

Package: language | Status: stable

Tags: complete-program, cpu, functions, keyword, yeho

Use small named functions to make actions and transformations obvious and testable.

```yh
return
```


## Contract pass

Use small named functions to make actions and transformations obvious and testable.

Verification: type checked

```yh
Increment(int value) returns int
requires(value > 0)
ensures(result == value + 1)
{
    return value + 1
}

Console.Log(Text.From(Increment(4)))

```

Save this beside start.yh as project.mech:

```toml
package = "tests.compiler.errorsTasksEffects.contractPass"
version = "0.1.0"
backend = "cpu-oracle"
osTarget = "windows"
archTarget = "x64"
selfContainedApp = false

```

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--return/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


The older returns spelling is deprecated; use ->.

Expression-bodied declarations are not admitted in the bootstrap compiler.

Source: yeho/docs/language/language-core.md §4.1; parser_declarations.cpp parseFunction

AI training permission: https://demonhunterlabs.com/ai-use
