Block
AKA "block phrase"
A function literal; specifically, an optional sequence of statements followed by a single value-returning expression, the whole of which is enclosed by square brackets. The block returns the value to which the expression evaluates.
Grammar:
- An open square bracket (
[
) - An optional parameter list: 0+ parameter declarations, comma-separated
- If there was at least one parameter declared, the parameter section is followed by a vertical bar
- An optional statement list
- An optional value-returning expression
- A closing square bracket (
]
) - If the expression returns type bottom, following the closing square bracket is a colon and that return type. Otherwise, this declaration of the return type is optional unless intentionally documenting or weakening the return type of the expression.
- A semicolon