> For the complete documentation index, see [llms.txt](https://docs.smartbotpro.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.smartbotpro.io/smartquery/introduction.md).

# Introduction

SmartQuery (SQ) is a scripting programming language created specifically to extend the capabilities of Smartbot chains.

## Why do you need SmartQuery?  <a href="#zachem-nuzhen-smartquery" id="zachem-nuzhen-smartquery"></a>

* Creating complex conditions in chains (combination of AND and OR)&#x20;
* Working with arrays and dictionaries (promo codes, inventory, word guessing, shopping cart, ...)&#x20;
* Substitution of calculated values ​​in the text of messages (same as regular variables, but you can use arithmetic)&#x20;

## Some examples <a href="#nekotorye-primery" id="nekotorye-primery"></a>

```
# complex conditions
%sex% == 'male' and %ref% == '1' or %sex% == 'female' and %ref% == '2'

# work with arrays
%cart%.push('perfume')
%cart%.push('webinar')

# substitution of expression values ​​in message text
Your balance: {{ %balance% + %premium% }}
```

SmartQuery can be used everywhere where only ordinary variables could be used before: in the text of messages, in mailing lists, conditions and on landing pages.
