{"id":"language--functions","name":"Function declarations and returns","owner":"yeho","package":"language","kind":"language","signature":"Name(Type parameter) { ... }\nName(Type parameter) -> ReturnType { return value }","description":"A function starts with its name, not a function keyword. Parameters are typed, -> names the return type, and a missing return type means void.","context":"Use small named functions to make actions and transformations obvious and testable.","parameters":[],"returns":"","members":[],"tags":["->","cpu","functions","language","return","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"docs/language/language-core.md §4.1; parser_declarations.cpp parseFunction"},"status":"stable","notes":["The older returns spelling is deprecated; use ->.","Expression-bodied declarations are not admitted in the bootstrap compiler."],"examples":[{"id":"complete","title":"Complete function declarations and returns example","description":"Use small named functions to make actions and transformations obvious and testable.","code":"DamageAfterArmor(int damage, int armor) -> int\n{\n    return damage - armor\n}\nConsole.Log(Text.From(DamageAfterArmor(30, 10)))\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__functions\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"8c8dd411eda3fc7dd8bd7f8f5fdbb0404670cd9d07198ba447510db8fdc1f4fd","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=language--functions","json":"https://demonhunterlabs.com/reference/items/language--functions.json","markdown":"https://demonhunterlabs.com/reference/text/language--functions.md"}
