Skip to main content
Skip table of contents

Understand the statements and conditions

Last updated: 02 August 2024

Below is a list of statements and conditions the platform supports.

Note that operators and programming languages evolve, making it nearly impossible to summarise and present all available options. If you are unsure, need help, or require the support of a new operate please reach out to your account manager.

Statements

if

An if statement is a fundamental control structure that allows you to make decisions based on certain conditions. Depending on whether a condition (see below) is true or false, your chatbot will execute one of the blocks of code you make available.

For example, your if statement could check whether a variable contains a value.

for

A for statement, also known as a loop, is a fundamental control structure that allows you to repeat an action multiple times. It's commonly used when you want to perform a task a specific number of times or iterate over a collection of items.

For example, your for statement could create as many cards in a carousel as there are values in your database.

Operations

Arithmetic

  • Addition (+)

  • Subtraction (-)

  • Multiplication (*)

  • Division (/)

  • Modulus (%)

  • Exponentiation (**)

Assignment

  • Basic assignment (=)

Comparison

  • Equal to (==)

  • Not equal to (!=)

  • Greater than (>)

  • Less than (<)

  • Greater than or equal to (>=)

  • Less than or equal to (<=)

Logical

  • Logical AND (and)

  • Logical OR (or)

  • Logical NOT (! or not)

String

  • Concatenation (+)

  • Repetition (*)

Set

  • Set

Conditions

starts with / ends with

Checks whether the value inside a variable starts or ends with a specific (set of) character(s). Example:

  • {% if custom.get.variable starts with 'H' %}

  • {% if custom.get.variable ends with '.com' %}

in / not in

Checks whether the value inside a variable is contained (or not) as part of a series of value. Example:

  • {% if custom.get.variable in [1, 2, 3] %}

  • {% if custom.get.variable not in [1, 2, 3] %}

is even / is odd

Checks whether the value inside a variable is an even or odd number. Example:

  • {% if custom.get.variable is even %}

  • {% if custom.get.variable is odd %}

is defined

Checks whether a variable has been declared or assigned a value. Example:

  • {% if custom.get.variable is defined %}

is divisible by()

Checks whether the value inside a variable is divisible by another value (number). Example:

  • {% if custom.get.variable is divisible by(3) %}

is empty

Checks whether a variable is empty. Example:

  • {% if custom.get.variable is empty %}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.