language · keyword ·
return
Leave a function with an optional value
Use small named functions to make actions and transformations obvious and testable.
returnStatus: stable
Contract pass
Use small named functions to make actions and transformations obvious and testable.
cpu · complete-program · type checked
Increment(int value) returns int
requires(value > 0)
ensures(result == value + 1)
{
return value + 1
}
Console.Log(Text.From(Increment(4)))
project.mech
package = "tests.compiler.errorsTasksEffects.contractPass"
version = "0.1.0"
backend = "cpu-oracle"
osTarget = "windows"
archTarget = "x64"
selfContainedApp = false
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