# exit

Immediately terminates script execution. Use this tag to stop processing when a condition is met or an error occurs.

```liquid
{% if order.cancelled %}
  {% log "Order is cancelled, skipping processing" %}
  {% exit %}
{% endif %}

{% comment %} This code will not run if order is cancelled {% endcomment %}
{% log "Processing order..." %}
```

#### Syntax

```liquid
{% exit %}
```

#### Use Cases

**Early termination on validation failure:**

```liquid
{% if customer.email == blank %}
  {% log "Customer email is required" %}
  {% exit %}
{% endif %}

{% email to: customer.email, subject: "Welcome!" %}
  <p>Thanks for signing up!</p>
{% endemail %}
```

**Skip processing based on conditions:**

```liquid
{% if product.tags contains "do-not-sync" %}
  {% exit %}
{% endif %}

{% comment %} Sync product to external system {% endcomment %}
{% http url: api_endpoint, method: "POST", body: product_data as http_result %}
```

**Stop after error response:**

```liquid
{% graphql query: my_query as result %}

{% if result.errors %}
  {% log result.errors %}
  {% exit %}
{% endif %}

{% log "Query successful" %}
```

**Conditional processing with multiple checks:**

```liquid
{% unless shop.plan_name == "enterprise" %}
  {% log "Feature only available for enterprise plans" %}
  {% exit %}
{% endunless %}

{% unless order.total_price > 1000 %}
  {% log "Order value too low for VIP processing" %}
  {% exit %}
{% endunless %}

{% log "Processing VIP order..." %}
```

#### Notes

* Execution stops immediately when `{% exit %}` is reached
* No code after the `exit` tag will be executed
* Useful for guard clauses and early returns
* Does not produce any output
