# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datajet-app.com/liquid/tags/exit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
