else (in if)

In functions or rule actions, the else keyword executes an alternate statement block.

Purpose

A side statement within an if statement to execute an alternate statement block depending on a Boolean expression value.

Context

Functions or rule actions

Syntax

if (test) {statement} 
 else {statement} 

Description

Use the if statement in the action part of a rule, a function, or a ruleflow. The test can be any legal test as in the Java™ programming language. If the test returns true, the first statement block is executed and the else block is skipped over. If the test returns false, the first block is skipped over and the statement block that follows the else clause is executed.

In a rule or function, any IRL statement, arithmetic expressions, and method calls can be executed within the statement block. In a ruleflow, any ruleflow statement can be executed within the statement block. A statement block can contain one or more statements. If it contains only one statement, the braces ({}) are not required. The else keyword and its statement block is optional.