A block, or code block, is a group of expressions that introduces a new body of code. You could also have a code block that contains zero expressions, but this is usually a placeholder that will be filled in with expressions at some later point.
Code blocks come after an identifier.
A code block has three possible formats in Verse. All of these formats are semantically the same in that the format does not change what the code actually does.
A spaced format begins the block with :, and each expression follows on its own line with an indentation of four spaces:
if (test-arg-block):
expression1
expression2Note that if (test-arg-block) is not part of the block, but the block starts at the end of that line with :. You can also use ; to separate multiple expressions on a single line:
if (test-arg-block):
expression1; expression2; expression3In a multi-line braced format, the block is enclosed by {} (curly braces), and the expressions are on new lines:
if (test-arg-block)
{
expression1
expression2
}As with the spaced format, you can also use ; to separate multiple expressions on a single line.
if (test-arg-block)
{
expression1; expression2
}The third format is the single-line braced format. Again, the block is enclosed by {}, but each expression is separated by ; instead of being placed on a new line. Note that you don't have to put the {} characters on separate lines.
if (test-arg-block) {expression1; expression2}For more on this, see Code Blocks.