{"id":"word--return","name":"return","owner":"yeho","package":"language","kind":"keyword","signature":"return","description":"Leave a function with an optional value","context":"Use small named functions to make actions and transformations obvious and testable.","parameters":[],"returns":"","members":[],"tags":["complete-program","cpu","functions","keyword","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":"Contract pass","description":"Use small named functions to make actions and transformations obvious and testable.","code":"Increment(int value) returns int\nrequires(value > 0)\nensures(result == value + 1)\n{\n    return value + 1\n}\n\nConsole.Log(Text.From(Increment(4)))\n","manifest":"package = \"tests.compiler.errorsTasksEffects.contractPass\"\nversion = \"0.1.0\"\nbackend = \"cpu-oracle\"\nosTarget = \"windows\"\narchTarget = \"x64\"\nselfContainedApp = false\n","tags":["cpu","complete-program"],"verification":"type checked","run":"cpu-oracle","source":"tests/compiler/errors-tasks-effects/contract-pass/start.yh","sha256":"7596733f355e82045916ad1e562cd4626d8883b61d0d8037ca088e9300e1733e","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=word--return","json":"https://demonhunterlabs.com/reference/items/word--return.json","markdown":"https://demonhunterlabs.com/reference/text/word--return.md"}
