{"id":"recipe--functions","name":"Name an action","owner":"yeho","package":"recipes","kind":"recipe","signature":"start.yh","description":"Write a function you can call more than once.","context":"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.","parameters":[],"returns":"","members":[],"tags":["cpu","recipe"],"updated":"2026-09-09","source":{"repository":"demonhunterlabs","path":"app/lib/yeho-walkthrough.ts"},"status":"complete-program","notes":["Give the second award a bonus of 50. Then call Award(5, 2) inside Console.Log using Text.From."],"examples":[{"id":"program","title":"Name an action","description":"Write a function you can call more than once.","code":"Award(int current, int bonus) -> int\n{\n    return current + bonus\n}\n\nint score = 0\nscore = Award(score, 10)\nscore = Award(score, 25)\nConsole.Log(Text.From(score))","manifest":"manifestVersion = \"2\"\npackage = \"api.example.recipe__functions\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","tags":["cpu"],"run":"cpu-oracle","expected":"35","verification":"type checked","sha256":"138d1b42d281ec01decbd0135ce803b5016f3167802dc2c2f09b2380e26d5ae2","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=recipe--functions","json":"https://demonhunterlabs.com/reference/items/recipe--functions.json","markdown":"https://demonhunterlabs.com/reference/text/recipe--functions.md"}
