> ## Documentation Index
> Fetch the complete documentation index at: https://reportana.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# If / else

The `if` property is a conditional structure that allows us to perform checks on specific system variables. With it, we can evaluate whether a given condition is true or false and execute different blocks of code based on that evaluation.

For *example*, check if the `order.total_price` variable is greater than *150* and dynamically apply a discount coupon based on the value:

```twig theme={null}
{% if order.total_price > 150 %}

Current Price: {{ order.total_price }}
Discounted Price: {{ (order.total_price * 0.85)|format_currency(order.currency|default(shop.currency_code)) }}
_(15% discount applied)_

{% else %}

Current Price: {{ order.total_price }}
Discounted Price: {{ (order.total_price * 0.90)|format_currency(order.currency|default(shop.currency_code)) }}
_(10% discount applied)_

{% endif %}
```

In this example, we check whether the `order.total_price` variable is greater than 150 using the `{% if %}` directive. If true, a 15% discount is applied, displaying the new discounted and formatted value. Otherwise, the `{% else %}` directive is used to apply a 10% discount, also showing the updated and formatted value.

In both cases, the code displays the current order value and the discounted value, along with an indication of which discount was applied.

**Sample output from the code:**

<img src="https://mintcdn.com/reportana/Jha6odPLZMMTun1e/ifelse-en.png?fit=max&auto=format&n=Jha6odPLZMMTun1e&q=85&s=5b350e847169f370c5ee1571293d94e3" alt="Example `if/else`" width="416" height="83" data-path="ifelse-en.png" />
