recipes · recipe ·

Name an action

Write a function you can call more than once.

cpurecipe

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.

start.yh

Status: complete-program

Name an action

Write a function you can call more than once.

cpu · type checked

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))
project.mech
manifestVersion = "2"
package = "api.example.recipe__functions"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Expected output
35
Notes and source

Give the second award a bonus of 50. Then call Award(5, 2) inside Console.Log using Text.From.

demonhunterlabs/app/lib/yeho-walkthrough.ts