SplitScript reference / Language / value block
value block
syntax
{ statements; finalExpression }
Runs scoped statements and yields its final expression.
A value block may appear anywhere an expression is accepted, including an if branch, match arm, fallback else, function argument, or state-field initializer. Its bindings are local to the block. The final expression supplies the block's value; a block without one yields None, unless control always leaves through return, break, continue, throw, or another Never expression. A semicolon after the final expression is accepted for familiarity but warned about and removed by the formatter because the expression is still the value. Function and lifecycle bodies are statement blocks, not value blocks: use return explicitly when they return a value.
Examples
Compute a value with local steps
let label = {
let level = 7
`Level {level}`
}
Prepare an argument locally
print({
let level = 7
`Level {level}`
})