Comment on page

Building conditions

In this article, we will cover the formation of the body of the condition block. Note that all the principles described below can be applied to other blocks that have a body (for example, the "print debug info" block and the "set variable complex value" block).

Creating containers

When we place any block in the body of the condition block, a container is automatically created in which this block will be placed. All containers have a white border:
The body of the condition block can contain an unlimited number of containers. Let's create another container - to do this we need to drop another block just below the already existing container:
Now the body of the condition block contains 2 containers, each container contains 3 nested blocks.

Logical operators

The logical operators "AND" and "OR" can be placed between two containers:
In this way, we can create different conditions. In the generated code, the condition block from the scheme above looks like this:
As you can see, the containers have been transformed into parentheses, and the boolean operator has been transformed into "||".
BotBrains is a no-code platform, so it doesn't make much sense to go into the details of the generated code. But if you are a programmer, exploring the generated code can help you understand how BotBrains code generator works.

Grouping containers

Sometimes it is necessary to group containers to form a complex condition. To group 2 or more containers, you need:
  1. 1.
    Hold the "shift" key
  2. 2.
    Left-click each grouped container in turn
  3. 3.
    Without releasing "shift" press the "G" key
Group the 2 existing containers and add the third one:
Note that after grouping, the containers were placed in one parent container.