if

This construct introduces the part of the rule in which you define conditions.

Purpose

You use this construct in a rule to define one or more condition statements.

Syntax

if
    <condition>*

Description

If the conditions in the if part are met, the actions in the then part of the rule are executed. The if part of a rule is optional. If there is no if part, all actions in the then part of the rule are done each time the rule is executed.

If the conditions in the if part of the rule are not met, the actions in the else part of the rule are executed. If the conditions are not met and the rule does not have an else part, the rule does nothing.

Example

The following rule shows how to test the age of a customer in a condition, then execute an action if this test is true.

if
   the age of the customer is less than 18
then 
   apply 10% discount to the shopping cart of the customer