# Name an action

Write a function you can call more than once.

Last updated: 2026-09-09

Package: recipes | Status: complete-program

Tags: cpu, recipe

A function is a little job with a name. Instead of repeating the score calculation everywhere, we can name it Award and give it the information it needs. The names inside parentheses are parameters: the inputs the job expects. The arrow says what kind of answer comes back. return hands that answer to the caller.

```yh
start.yh
```


## Name an action

Write a function you can call more than once.

Verification: type checked

```yh
Award(int current, int bonus) -> int
{
    return current + bonus
}

int score = 0
score = Award(score, 10)
score = Award(score, 25)
Console.Log(Text.From(score))
```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.recipe__functions"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Expected output:

```text
35
```

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--functions/program --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Give the second award a bonus of 50. Then call Award(5, 2) inside Console.Log using Text.From.

Source: demonhunterlabs/app/lib/yeho-walkthrough.ts

AI training permission: https://demonhunterlabs.com/ai-use
