# Expressions

### **Introduction to Open Loyalty Language**

\
When setting up conditions and effects for rules in [Campaigns](https://help.openloyalty.io/campaigns), you may find that some situations are not covered by premade values. However, you are not limited to using these values - you can use an Open Loyalty language to create very specific conditions and values. \
\
In conditions, you can find a condition called **Expressions**. <br>

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FPN5ANJBmkAB3rO27uxEc%2Fimage.png?alt=media&#x26;token=d635418f-c750-4eba-ac0e-67213d40e7be" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FV4E0SHArolymdan9USyB%2Fimage.png?alt=media&#x26;token=991c8241-6c6a-4866-987a-752b91d199a6" alt=""><figcaption></figcaption></figure>

You can set the value of such an expression. It can be set as a combination of attributes and operators using the meta language created by Open Loyalty. It allows you to create a fully customizable condition that meets the rules of your planned loyalty program.&#x20;

For example, you can create a campaign that is triggered when a customer buys a product from a certain category. You can do it in two ways:

Set a premade condition:

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2F8zJLGRDKHrKrbPYN5LAa%2Fimage.png?alt=media&#x26;token=11d5e51b-2301-4989-a86e-d2425ffdce80" alt=""><figcaption></figcaption></figure>

Or use an expression:

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2F7hnRxkz3QM9tUeiAehHi%2Fimage.png?alt=media&#x26;token=c254a626-ce8a-42fa-8e74-8c1b4ad4e4fc" alt=""><figcaption></figcaption></figure>

In the same way, you can create custom campaign effects - you can use premade values, or enter them yourself:

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FRS90QNPbPEmmRxAdFLg8%2Fimage.png?alt=media&#x26;token=7888400c-35b5-4565-9ee0-824766ecb283" alt=""><figcaption></figcaption></figure>

In this section, you will find a description of the meta-language together with all the supported syntaxes, which is based on the expression syntax of Symfony Expression.

***

#### **The component supports**

* strings - single and double quotes (e.g. 'hello')&#x20;
* numbers - integers (e.g. 103), decimals (e.g. 9.95), decimals without leading zeros (e.g. .99, equivalent to 0.99); all numbers support optional underscores as separators to improve readability (e.g. 1\_000\_000, 3.14159\_26535)
* arrays - using JSON-like notation (e.g. \[1, 2])
* hashes - using JSON-like notation (e.g. { foo: 'bar' })
* booleans - true and false
* null - null
* exponential - also known as scientific (e.g. 1.99E+3 or 1e-2)
