Else clause with an evaluate statement
Technical rules with an evaluation statement in the condition part can have an optional
else statement in the action part.
When the condition part of a rule finishes with an evaluate statement, the action part of the rule might include an else clause. The else clause is optional. The last evaluate expression in the condition part acts as a discriminator, to choose between the then or the else execution branches. If the evaluate expression is true, the then part is run; if it is false, the else part is run.
If the rule ends with several evaluate statements,
only the last one is used to discriminate.
Here is an example of a rule with an else statement:
rule myrule
{
when
{
?s : String(startsWith("Irl"));
evaluate(?s.length() > 30);
}
then
{
out.println("Very long string");
}
else
{
out.println("String length is reasonable");
}
};