ILOG Rules for .NET User Guides > Rule Studio > Writing Rules > Actions

The action part of a rule describes what to do when the conditions of the rule are met, and in some cases what to do if the conditions are not met. Actions are represented in the Intellirule Editor by whatever appears after then or else.

For example, in the following rule, a discount of 15% is applied when the value of the shopping cart is more than $100.

 if
     the value of the shopping cart is more than $100
 then
     apply a 15% discount on the shopping cart;

Note
At least one action must be specified in the action part of a rule. This is not the case for the definitions and conditions parts.

If there is more than one action to perform, they are carried out in the order in which they appear in the action part.

The else part of a rule is an optional block of actions that specify what to do when the conditions are not met. For example, in the following rule, a 15% discount is applied when the conditions are met, and a 5% discount is applied when the conditions are not met.

 if
     all of the following conditions are true:
        - the value of the shopping cart of this customer is more than $100
        - the category of the customer is Gold
 then
     apply a 15% discount on the shopping cart;
 else
     apply a 5% discount on the shopping cart;

In other words, if the value of the shopping cart is not more than $100 or if the customer category is not Gold, the customer will still receive a 5% discount.

It is also possible to refine the use of the else part of a rule by setting variables in the definitions part. This is explained in section Using Definitions with the Else Part.

See Also

Conditions | Using the Properties of Business Rules