ILOG Rules for .NET User Guides > ILOG Rule Solutions for Office > Writing and editing rules > Define variables and constants > Define a variable

You define a variable by giving it a name of your choice and then setting this variable to a value. This value can be a number (or an arithmetic expression), text, or a predefined business term that already appears in your rule (for example, customer). Once you have set a variable, it becomes available in all parts of the current rule.

Note
If the name of your variable contains one or more spaces, you must enclose the variable name in single quotes.

Variables are useful when constructing rules that deal with relationships between two or more things of the same type. For example, the following condition statement involves two different customers:

 If
     'customer 1' is married to 'customer 2'

Here, we have identified and named two different customers: `customer 1' and `customer 2'. You can see that by making the notion of a customer something that varies, and having the possibility of identifying them specifically, you can create rules such as:

 Definitions
     set 'customer 1' to a customer;
     set 'customer 2' to a customer;
 If
     'customer 1' is married to 'customer 2'
     and 'customer 2' is insured
 Then
     upgrade 'customer 1''s rating;

See Also

definitions

set <variable> to <definition>