Calculator
Calculator is a field in the "Editor" block that opens when you click on the tab with the same name. In this field, you can perform logical or arithmetic operations, execute functions of API requests from the builder, and available integrations.
It allows you to assign (declare) a variable for the client who has entered this block or update the values of existing variables. This functionality is especially useful for building funnels or tracking traffic sources.
The article with the same title explains how to work with variables.

Key points:
When working with the calculator, a variable name cannot start with a number.
Incorrect: <1_name> Correct: <name_1>.
A variable name cannot contain spaces; use an underscore "_" to separate words. Incorrect: <Client Name> Correct: <Client_Name>
For more details, read the article "Variables." ссылка
How to use the Calculator in the Builder
There is no need to use the #{} syntax when referencing a variable.
Example of calculating a variable’s value in the Calculator field:

Variables can be referenced either by their name directly or using the #{} syntax. All variables are automatically converted to floating-point numbers.
The calculator supports all necessary logical and arithmetic operations.
Comments in the Calculator
To add comments in the Calculator, use /* comment text /. This / */ syntax allows you to write both single-line and multi-line comments:

Remember to always close your comment with the */ tag at the end; otherwise, the comment will continue onto the next line.

Remember to include the closing tag for the comment, even if the comment is the last line in the "Calculator" field.
Don’t place comments directly one after another; there must be at least one empty line between them.
Constants
"E": Euler’s number e
Supported operators
"+": addition
"-"': substraction
"*" multiplication
"/": division
"%'": remainder of division
"^" "**": exponentiation
"==" "!=" ">" "<" ">=" "<=": comparison operators
"and" "AND" "&&": logical AND
"or" "OR" "||": logical OR
Important! Logical triggers with variables must be written in the "Variable" field, not in the "Trigger" field!
For example, the transition along the connector will occur if the variable Phone_Number is filled. See the figure below:

Note!
If you compare a variable to a value in quotation marks, make sure there are no spaces between the quotes and the value; otherwise, the block may fail to trigger or behave incorrectly!
Correct (no space before the quotation mark or after the value my_new_bot):

Incorrect (with a space before the quotation mark):

Last updated