Skip to content

Conditions

Conditional statements in CES allow scripts to execute different blocks of code depending on whether a condition is true or false.

Conditions are commonly used to control program flow, validate values, and create dynamic behaviors.

If statement

The if statement executes a block of code only when the specified condition is true.

Example:

Int value: 10;

if(value > 5)
{
    DisplayLog("Greater");
}

Output:

if image

Else if statement

The else if statement checks an additional condition when the previous if condition is false.

Example:

Int value: 10;

if(value > 10)
{
    DisplayLog("Greater");
}
else if(value == 10)
{
    DisplayLog("Equal");
}

Output:

else if image

Else statement

The else statement executes when none of the previous conditions are true.

Example:

Int value: 5;

if(value > 10)
{
    DisplayLog("Greater");
}
else
{
    DisplayLog("Smaller");
}

Output:

else image

CES supports the following comparison operators:

  • == equal to
  • != not equal to
  • > greater than
  • < less than
  • >= greater than or equal
  • <= less than or equal