Body clause
Use a body clause in a rule to call slot assignments, primitives, or functions. In a body clause, functions return an expression, and primitives return a Boolean value expressing the success or failure of the primitive.
For more information about primitives and functions, see MRL-functions-and-primitives.
The syntax of the body clause is as follows:
<Variable>.<SlotName> = <Value>;
<Call> ;
}
The syntax to call a slot assignment in a body clause is as follows:
if-then-else construct
The if-then-else construct is a special call used in a body clause that specifies a conditional execution. The syntax for the if-then-else construct is as follows:
then
{
<Variable>.<SlotName> = <Value>;
<Call> ;
}
[ else
{
<Variable>.<SlotName> = <Value>;
<Call> ;
}
]
The else body clause is optional. If the Expression is evaluated as true, the statements in the then block are executed. However, if an else block is included in the body clause and the statement is evaluated as false, the statements in the else block are executed.
You can refer to a local variable declared in the then and else block after the if-then-else call if the variable is declared in both the then and else block with the same data type, as shown in the following example:
{
...
$TEMP = ' yes' ;
...
}
else
{
...
$TEMP = ' no';
...
};
$EV.msg = $TEMP;
It is unnecessary to use an if-then-else construct to create a conditional affectation. A simpler solution is to use a conditional expression.