Reference > Rule Languages > Business Action Language > BAL Constructs > if

Summary

Introduces the part of the rule in which you can define conditions.

Syntax

if
    <condition>*

Description

The if part of a rule contains one or more condition statements. If the conditions in the if part are met, the actions in the then part of the rule are executed. The if part of a rule is optional. If there is no if part, all actions in the then part of the rule are performed each time the rule is executed.

If the conditions in the if part of the rule are not met, the actions in the else part of the rule are executed. If the conditions are not met and the rule does not have an else part, the rule does nothing.

Example

The following rule shows how to test the age of a customer in a condition, then execute an action if this test is true.

if 
   the age of the customer is less than 18
then 
   apply 10% discount to the shopping cart of the customer

Related Concepts

Rule Conditions

Related Tasks

Creating Business Rules

Related Reference

all of the following conditions are true
any of the following conditions is true
from <object>
in <list>
none of the following conditions are true
the number of <objects>
there are <number> <objects>
there are at least <number> <objects>
there is at least one <object>
there are more than <number> <objects>
there is at most one <object>
there is no <object>
there is one <object>
where <test>

Related Samples and Tutorials

Tutorial: Creating Business Rules