Sharpee
Chord / Flow & Progression / Ordinal blocks

Ordinal blocks

An ordinal block runs its body only on the Nth time the enclosing clause fires. The ordinals first time through tenth time appear in statement position, interleaved with ordinary statements:

  on knocking it
    phrase knock-echo
    first time
      phrase knock-first
    second time
      change it to smudged
      phrase knock-second
    fifth time
      phrase knock-fifth
  end on

Every knock speaks knock-echo; the ordinal blocks add to it on the first, second, and fifth knock only. The ordinals need not be contiguous; jumping first, second, fifth is fine, and the gaps simply do nothing. Each block dedents to close; there is no end keyword.

This is the same keyword pair as the create-block first time description, and the collision is worth naming. Inside a create block, at the top level of the block, first time opens the room's first-visit description and only first time is legal there. Inside a behavior body, first time opens an ordinal block and the whole family through tenth time is available. Position decides which one you get: a first time directly under create is a description, a first time inside on/after is an ordinal.