ILOG Rules for .NET User Guides > ILOG Rule Solutions for Office > Writing and editing rules > Define variables and constants > Use definitions with the Else part

Normally, the actions in the Else part of a rule are executed when the condition(s) set in the If part are not satisfied. However, if you use conditions to restrict the variables in the Definitions part of the rule, the actions in the Else part will only be executed if these additional condition(s) are satisfied.

For example, in the following rule a discount is always applied since any customer will receive at least a 5% discount:

 If
     all of the following conditions are true:
         - the value of the customer's shopping cart is more than $100
         - the category of the customer is Gold
 Then
     apply a 15% discount;
 Else
     apply a 5% discount;

However, if you adjust the rule using the Definitions part, a discount is only applied for customers in the Gold category:

 Definitions
     set 'applicant' to a customer
         where the category of this customer is Gold;
 If
     the value of the shopping cart of 'applicant' is more than $100
 Then
     apply a 15% discount;
 Else
     apply a 5% discount;

See Also

definitions

set <variable> to <definition>

where <test>