The Avail Programming Language
Mobile Users: Click here to view our text rendering warning.

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:

  1. An open square bracket ([)
  2. An optional parameter list: 0+ parameter declarations, comma-separated
  3. If there was at least one parameter declared, the parameter section is followed by a vertical bar
  4. An optional statement list
  5. An optional value-returning expression
  6. A closing square bracket (])
  7. 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.
  8. A semicolon