> For the complete documentation index, see [llms.txt](https://docs.datajet-app.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datajet-app.com/liquid/tags/exit.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
