SplitScript reference / Language / return

return

keyword

return expression

Returns from the current function or action.

return is an ordinary Never-typed expression, so it may appear anywhere an expression is accepted and satisfies any surrounding expected type by leaving the current function or action instead of yielding locally. Functions infer their result from explicit return expressions and call-site constraints. Unlike a nested value block, a function or lifecycle body never returns its final expression implicitly. Lifecycle actions apply their domain default when control falls through.

Examples

Return a value

fn double(value) {
    return value * 2
}