Strict Antecedent Basis: Blocks and Scope

Created: Oct 27, 2016; Modified: Oct 31, 2016.


I am updating, or adding to, this page. Please let me know if you have suggestions or fixes. You can let me know on Twitter (@is4tomj) or make a pull request on https://github.com/is4tomj/is4tomj-hugo.

Blocks

A block is a group of components or steps that are related. Block that are multi-line blocks should be visually identifiable with indentation. The first line of a multi-line block should end with a : and each subsequent line in the block should have a deeper indentation than the first line of the block. The second to last line should end with one of the following, whichever is more appropriate:

  • , or,
  • ; or,
  • , and, or
  • ; and.

The following is an example of a multi-line block.

for each thing among a plurality of things:
  doing a first action with the thing; and
  doing a second action with the thing;

A single-line block is used primarily to iterate over a set. Accordingly, single-line blocks are discussed in Sets and Iteration.

Nested Blocks

A block may include one or more blocks. The following is an example of a block that includes a nested block.

A method comprising:
  receiving a plurality of things;
  for each thing in the plurality of things:
    doing a first action with the thing; and
    doing a second action with the thing.