Skip to content
Input & data

Calculator: the bot computes by a formula and remembers the result

Adds, multiplies and rounds by your formula — the order total with a discount or the delivery cost — and puts the result into a variable.

In short

The "Calculator" block in the Forgebot Telegram bot builder is a flow step where the bot computes by a formula you set (with numbers, variables and rounding functions) and saves the result to a variable. Use it where you need to work out an order total, a discount, a delivery cost or change due.

Free plan — no card required.

The “Calculator” block’s settings panel in the editor
About the block

What the "Calculator" block does

The bot takes your formula, plugs in values gathered earlier (a price and a quantity, say) and computes the result. The calculation runs on the server — the person doesn't see it, they only get the finished figure where you choose to show it. The bot remembers the result in a "cell" (a variable) to insert into a message or use later.

Fields

Block settings

The block's settings panel — what to fill in:

Formula
The calculation itself — for example {{price}} * {{qty}} * 0.9 (price × quantity with a 10% discount). You can use numbers, the signs + − * /, brackets and the functions round, floor, ceil, abs, min, max. Up to 500 characters.
Result variable
The name of the "cell" to put the result into — for example total. Latin letters, no spaces, not starting with a digit.
Where to store the result
Remember the result only within this conversation or attach it to the person permanently. Only within this conversation by default.
Decimal places
How many digits to keep after the decimal point: 2 for money (500.00), 0 for a whole number. From 0 to 8, 2 by default.
Example

Example: order total with a discount

The customer chose 3 coffees at 80 UAH. The "Calculator" block computes {{price}} * {{qty}} * 0.9 as 216.00 and puts the result into the variable total. Next the bot issues an invoice for that amount with the "Payment" block.

FAQ

Frequently asked questions

How do I insert a price or quantity into the formula?

Tap the braces button {} next to the formula field and pick the variable from the list — it's inserted as {{name}}. These are values the bot gathered earlier (via the "Ask" block, say) or the bot's global variables.

Which operations and functions can I use?

Numbers and the signs for addition, subtraction, multiplication and division (+ − * /), brackets for order of operations, and the functions round, floor, ceil, abs, min, max — rounding, absolute value, minimum and maximum. The formula itself is checked on the server when you save.

How is "Calculator" different from the "Save value" block?

"Save value" just puts a ready value into a cell. "Calculator" first computes by a formula (multiplies, adds, rounds) and only then stores the resulting number.

// Start today

Launch your Telegram bot with Forgebot

Build your first flow, reply to subscribers and watch analytics — free, no code.

Free plan: 1 bot, 5 flows, 100 subscribers. No card required.