Conditional statements allow your policy to behave differently depending
on a condition by using if statements.

Conditional statements may only appear outside of
rule expressions, such as in
functions or in the global scope
of a policy. This is because rules are only allowed to contain a single
boolean expression.

if statements only execute their bodies if a condition is met.
The syntax of an if statement is:

if condition {
// ... this is executed if condition is true
}

The condition must result in a boolean, such as by calling a function
or evaluating a boolean expression. If
the condition is true, the body (within the {}) is executed. Otherwise,
the body is skipped.

Examples:

// This would execute the body
value=12ifvalueis18{print("condition met")}// Direct boolean values can be used
value=trueifvalue{print("condition met")}// This would not execute the body since the boolean expression will
// result in undefined.
value={}ifvalue["key"]>12{print("condition met")}

An else clause can be given to an if statement to execute a body
in the case the condition is not met. By putting another if statement
directly after the else, multiple conditions can be tested for.
The syntax is: