'Expression' is a term for action code involving some evaluation, and by extension any discrete complete section of action code. Thus even the simplest code, such as the assignment of a literal value, may still be regarded as an expression:
$Text="A Life on the Ocean Wave.";
Normally, actions and stamps require an action: an assignment, or an if(), each(), or var() statement.
However, actions may be expressions, which are evaluated for their side-effects. For example, "frogs".speak()
is technically an expression, not an action, but if the action is run, the macOS will say the word "frogs". More often, actions and rules may use simple arithmetic and logical expressions.
$Width=5+2;
$Width=$Height(parent)*1.5;
$Urgent= ($Overdue|$Essential);
$Width =($Width(/$Configuration)+1)*$Scale;
Note the latter examples above the right-side involves more complex evaluation where extra parentheses are added to make explicit the evaluation order, as discussed further here.
One action, e.g. rule, can have multiple expressions:
$Color= "blue";$Badge="ok";
Multiple expressions must be delimited by semi-colons. Line breaks between expressions are optional. They may aid legibility of code but have no effect on how the code is parsed.
Because Tinderbox recognises operators such as + and -, notes whose names begin with characters other than letters and numbers may sometimes be interpreted in unexpected ways. For example, if a note is named "6*7", rules like
$Prototype=6*7
…might be parsed as a multiplication with the result of 42.
$Prototype="6*7"
…should have the expected effect. Quoting characters will always cause Tinderbox to treat such content as literal text.
Actions and rules may use computation with data attributes, including attribute values from other notes. For example:
$DueDate=$DueDate(parent)+"7 days";
$DueDate=$ExpiryDate(parent)-"10 days";
Date attribute values can also be computed with literal dates and date designators:
$DueDate="November 15, 2004"+"7 weeks"
In the previous examples note that the actual and partial date strings use quotes.
See further discussion of expressions: