ルール・アクション

ルール・アクションでは、ルールの if 部分が true の場合または false の場合に何を実行するかを定義します。

アクションは、ルールの then 部分と else 部分で定義します。 ルール・アクションは、ルールの if 部分が true の場合に実行される 1 つ以上のアクション語句で構成されます。ルールの if 部分が false の場合に実行されるアクション語句を含めることもできます。

アクションは、ルールの次の部分で定義します。

ルールの then 部分では、1 つ以上のアクションを定義する必要があります。 then 部分または else 部分に複数のアクションが含まれる場合、ルールは、リストされている順序でアクションを実行します。

then 部分の例

次のルールでは、ショッピング・カートの値が $100 より大きい場合にのみ、15% の割引が適用されます。それ以外の場合、ルールはアクションを何も適用しません。

if 
	the value of the shopping cart is more than $100 
then 
	apply a 15% discount on the shopping cart; 

else 部分の例

次のルールは、条件が満たされた場合に (then)、ある変更を適用し、条件が満たされなかった場合には (else)、別の変更を適用します。

if 
	'the loan report' is approved 
	and the loan grade in 'the loan report' is one of { "A", "B", "C" } 
then 
	in 'the loan report', accept the loan with the message "Congratulations! Your loan has been approved"; 
else 
	in 'the loan report', refuse the loan with the message "We are sorry. Your loan has not been approved";