Tapestry
Source Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Logic

Boolean operations and loop handling.

Definitions:

Slots:

  • Brancher: Helper for the else statements of [ChooseBranch].

Commands:

  • Always: This always returns true.
  • Break: In a repeating loop, exit the loop; or, in a rule, stop processing rules.
  • Continue: In a repeating loop, try the next iteration of the loop; or, in a rule, continue to the next rule.
  • Finally do: Run a set of statements after a condition has failed.
  • If:[assuming:]do:[else:] Select a block of statements to run based on a true/false check.
  • Is all: Check that every condition in a set of conditions returns true.
  • Is any: Check whether any condition in a set of conditions returns true.
  • Is value: Determine the "truthiness" of a value.
  • Never: This always returns false.
  • Not: Determine the opposite of a condition.
  • Not all: Check that every condition in a set of conditions returns false.
  • Not any: Check whether any condition in a set of conditions returns false.
  • Not value: Determine the "falsiness" of a value.
  • Num if:[assuming:]then:[else:] Pick one of two possible text values based on a condition.
  • Repeat if:[initially:][assuming:]do: Keep running a series of actions while a condition succeeds.
  • Text if:[assuming:]then:[else:] Pick one of two possible text values based on a condition.

Commands

This always returns true.

Slots:

Terms:

None.

In a repeating loop, exit the loop; or, in a rule, stop processing rules.

Slots:

Terms:

None.

In a repeating loop, try the next iteration of the loop; or, in a rule, continue to the next rule.

Slots:

Terms:

None.

Run a set of statements after a condition has failed.

Slots:

Terms:

do: Execute repeats

One or more statements to run.

Select a block of statements to run based on a true/false check.

Slots:

Terms:

If: BoolEval

The condition to test.

assuming: optional Arg repeats

A set of local variables available while testing the condition and while running the do/else statements. These are initialized before testing the condition.

do: Execute repeats

Statements which run when the condition succeeded.

else: optional Brancher

An optional set of statements to evaluate when the condition failed.

Check that every condition in a set of conditions returns true. Stops after finding a failed condition. An empty list returns false.

Slots:

Terms:

all: BoolEval repeats

One or more conditions to check for success.

Check whether any condition in a set of conditions returns true. Stops after finding the first successful condition. An empty list returns false.

Slots:

Terms:

any: BoolEval repeats

One or more conditions to check for success.

Determine the "truthiness" of a value. Bool values simply return their value. Num values: are true when not exactly zero. Text values: are true whenever they contain content. List values: are true whenever the list is non-empty. ( note this is similar to python, and different than javascript. ) Record values: are true whenever they have been initialized. ( only sub-records start uninitialized; record variables are always true. )

Slots:

Terms:

value: Assignment

The value to test.

This always returns false.

Slots:

Terms:

None.

Determine the opposite of a condition.

Slots:

Terms:

Not: BoolEval

The condition to check.

Check that every condition in a set of conditions returns false. Stops after finding any successful condition. An empty list returns false.

Slots:

Terms:

all: BoolEval repeats

One or more conditions to check for failure.

Check whether any condition in a set of conditions returns false. Stops after finding any failed condition. An empty list returns false.

Slots:

Terms:

any: BoolEval repeats

One or more conditions to check for failure.

Determine the "falsiness" of a value. This is the opposite of [TrueValue].

Slots:

Terms:

value: Assignment

The value to test.

Pick one of two possible text values based on a condition. ( This acts similar to a ternary. )

Slots:

Terms:

if: BoolEval

The condition to test.

assuming: optional Arg repeats

A set of local variables available while testing the condition and while running the do/else statements. These are initialized before testing the condition.

then: NumEval

The number to use if the condition succeeds. ( The eval is only processed if the condition succeeded. )

else: optional NumEval

The number to use if the condition fails. ( The eval is only processed if the condition failed. )

Keep running a series of actions while a condition succeeds.

Slots:

Terms:

if: BoolEval

The condition to check before running the loop. If it succeeds, execute the loop; if it fails, stop executing the loop.

initially: optional Arg repeats

A set of variables available to the loop; evaluated just once, before the loop's first run.

assuming: optional Arg repeats

A set of variables available to the loop; evaluated before each iteration of the loop. ( These take precedence over the initial variables. If the same names appear in both sets of variables, the ones here win. )

do: Execute repeats

The statements to execute every loop.

Pick one of two possible text values based on a condition. ( This acts similar to a ternary. )

Slots:

Terms:

if: BoolEval

The condition to test.

assuming: optional Arg repeats

A set of local variables available while testing the condition and while running the do/else statements. These are initialized before testing the condition.

then: TextEval

The text to use if the condition succeeds. ( The eval is only processed if the condition succeeded. )

else: optional TextEval

The text to use if the condition fails. ( The eval is only processed if the condition failed. )