# Calculate

The *Calculate* action node allows you to perform mathematical operations on flow variables.

You can use two types of mathematical operations:

* **Comparison:** Variables are compared against each other as per the expression -  if it matches, a "Yes" result is returned, if it doesn't match, a "No" result is returned.
* **Calculation:** The result of the expression is calculated and stored under a session variable \[\[actionName:result]]*.* In other words, if you want to refer to the result of this calculation in another node, \[\[actionName:result]] is the variable name you should use. If successfully calculated, a "Yes" result is returned, else a "No" result is returned.

<figure><img src="https://content.gitbook.com/content/joAgInTNsBfDdfx1I23z/blobs/XMx9kipv4QNNd3iepbUO/image.png" alt="" width="563"><figcaption><p>Setup of a Calculate node</p></figcaption></figure>

![Example flow containing Calculate node](https://content.gitbook.com/content/joAgInTNsBfDdfx1I23z/blobs/e752kBIqi0S3ld97lo6n/image.png)

### Examples

The table below describes examples of mathematical expressions you can define in Chat Flow. You can create expressions as simple or complex as required.&#x20;

| Description | Example                                                                                                               |                            |
| ----------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| + - / \*    | Standard math calculations (add, subtract, divide, multiply)                                                          | a+b, a-b, a/b, a\*b        |
| = > < >= <= | Standard comparison operators (equals to, greater than, less than, greater than or equals to, less than or equals to) | a=b, a>b, a\<b, a>=b, a<=b |
| !=          | Not equal to comparison operator                                                                                      | a!=b                       |
