# Function declarations and returns

A function starts with its name, not a function keyword. Parameters are typed, -> names the return type, and a missing return type means void.

Last updated: 2026-09-09

Package: language | Status: stable

Tags: ->, cpu, functions, language, return, yeho

Use small named functions to make actions and transformations obvious and testable.

```yh
Name(Type parameter) { ... }
Name(Type parameter) -> ReturnType { return value }
```


## Complete function declarations and returns example

Use small named functions to make actions and transformations obvious and testable.

Verification: type checked

```yh
DamageAfterArmor(int damage, int armor) -> int
{
    return damage - armor
}
Console.Log(Text.From(DamageAfterArmor(30, 10)))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.language__functions"
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--functions/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
