Statements

A statement can be one of:

When expression results to a directive, then this directive is executed at compile time and replaced with its result, if any.

Otherwise, an expression is treated as a condition. Its value is discarded, while the logical value not. So, an expression used as a statement is effectively the same as ++<expression>.

A sentence containing member declaration can not contain any other statements (except for some directives).

Declarative Block

A declarative block is a group of sentences enclosed into parentheses:

'(' [ <sentence> ] ... ')'

#

Each statement, except a member declaration, has a logical value. It is possible to logically combine the statements by separating them with:

  • a colon (,) to declare the first statement is a requirement of the other, or
  • a semicolon (;) to declare the second statement is an alternative to the first one.

Requirements

To declare that one statement is required by another, the requirement statement should be separated from the dependent one by comma (‘,‘):

<requirement> ',' <dependent>

The <requirement> has to be true for the <dependent> to be evaluated. The logical result of the whole construction is true if both <requirement> and <dependent> succeed. This corresponds to the logical AND.

Examples:

False, = 2   ~~ Always false. The `2` is ignored.
Foo > 0, = 1 ~~ The value is `1` if `foo` is positive, or false otherwise.

More than two statements can be combined:

Foo >= 0, foo <= 100, = "percent" ~~ The value is `"percent"` if `foo` between
                                  ~~ `0` and `100`, or false otherwise.

A return statement can not be used as a requirement of another one. So the following is incorrect:

foo >= 0, = "percent", foo <= 100 ~~Redundant statement.~~

Alternatives

To declare that a group of statements can be executed only when the preceding group failed, the following syntax can be used:

<alternative1> ';' <alternative2>

where:

  • <alternative1> is one ore more comma-delimited statements, which will be executed first;
  • <alternative2> is zero or more comma-delimited statements, which will be executed only when the <alternative1> fails.

More than two alternatives can be combined.

Note that the comma (‘,‘) has a higher precedence over a semicolon (‘;‘).

The logical result of the whole construction is true when either of alternatives succeeded. This corresponds to the logical OR.

An example:

a > 0, = "Positive"; ~~ Value is `"positive"` if `a` is positive.
a < 0, = "Negative"; ~~ Otherwise, value is `"negative"` if `a` is negative.
= "Zero"             ~~ Otherwise, value is `"zero"`.