A statement can be one of:
- an expression,
- a return,
- a yield,
- a member declaration,
- a local declaration,
- an assignment,
- a declarative block, or
- an imperative block.
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
A sentence containing member declaration can not contain any other statements (except for some directives).
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.
To declare that one statement is required by another, the requirement statement
should be separated from the dependent one by comma (‘
<requirement> ',' <dependent>
<requirement> has to be
true for the
<dependent> to be evaluated. The
logical result of the whole construction is
true if both
<dependent> succeed. This corresponds to the logical AND.
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.~~
To declare that a group of statements can be executed only when the preceding group failed, the following syntax can be used:
<alternative1> ';' <alternative2>
<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
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.
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"`.