language · language ·
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.
Use small named functions to make actions and transformations obvious and testable.
Name(Type parameter) { ... }
Name(Type parameter) -> ReturnType { return value }Status: stable
Complete function declarations and returns example
Use small named functions to make actions and transformations obvious and testable.
cpu · language · type checked
DamageAfterArmor(int damage, int armor) -> int
{
return damage - armor
}
Console.Log(Text.From(DamageAfterArmor(30, 10)))
project.mech
manifestVersion = "2"
package = "api.example.language__functions"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
[app]
kind = "headless"
Notes and source
The older returns spelling is deprecated; use ->.
Expression-bodied declarations are not admitted in the bootstrap compiler.
yeho/docs/language/language-core.md §4.1; parser_declarations.cpp parseFunction