Defining a variable

When you define a variable, you must use the correct ILOG® Rule Language syntax.

To define a variable, or to define an object variable inside a test, use the following pattern:

[variable:] ClassName(variable: <value>)

Example

when {
   account: Account(balance : getBalance());
// the balance is defined as the balance of this account; 
// it is a double; it cannot be matched
// in an instance condition, which only accepts Object instances.

   contract: Contract( expiration : getExpirationDate() );
// now expiration is defined as the expiration date of the contract
}
then {
  System.out.println(contract + expiration);
  System.out.println(account + balance);
}