Punctuation in rules

The rule language uses punctuation to identify specific language artifacts and to avoid ambiguous syntax. When you edit business rules, mandatory punctuation is usually predicted in the completion menu.

Backslash \

The backslash is used to prefix special characters in text strings.

Comma ,

The comma marks the end of Where statements.

Example

This example shows a Where statement that is closed by a comma.

if
  there is at least one car
    where
      the color of this car is blue,
then ... 

Some language constructs may be terminated by an optional comma.

Example

This example shows a construct that is terminated by an optional comma. This may prevent the construct becoming ambiguous in a particular context.

all following conditions are true:
  - the color of car is blue
  - the price of car is more than 1000,

Double quotation mark "

Double quotation marks are used to enclose string literals; that is, text strings.

Example

This example shows an action phrase in which the message to be displayed is a text string enclosed in double quotation marks.

print "You received a discount!";

Parentheses ()

Parentheses can be used to group any expression. They can help clarify the default precedence of logical operators linking conditions to one another. You can also use parentheses to regroup condition statements and hence change the order in which they are interpreted.

Example

This example shows nested parentheses in an action phrase.

print "the customer: " + (the name of customer of ('shopping cart'));

Semicolon ;

The semicolon marks the end of variable definitions and action phrases.

Single quotation mark '

Single quotation marks are used to enclose variables. Single quotation marks are optional for single-word variables and mandatory for variables that consist of several words.

Example

In this example, the variables customer and the cart are defined. The customer variable does not need to be enclosed in single quotation marks because it is a single word, whereas the cart needs to be delimited because it consists of two words.

definitions
    set customer to a customer;
    set 'the cart' to the shopping cart of customer;