> For the complete documentation index, see [llms.txt](https://support.emarketeer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.emarketeer.com/references/developer-advanced/dcl-introduction/conditionals.md).

# Conditionals

DCL supports a simple if-elseif-else-endif conditional for testing whether one string equals another.

Conditional functions follow normal function syntax and always return an empty string. They cannot be used as arguments to other functions. You can test for equality or inequality. There is no concept of boolean operators, but you can simulate AND by nesting conditionals.

Check if "foo" is equal to "foo" (true):

```
<% if compare="foo" equal="foo" %>
```

Check if "foo" is equal to "bar" (false):

```
<% if compare="foo" equal="bar" %>
```

Check if "foo" is not equal to "foo" (false):

```
<% if compare="foo" notequal="foo" %>
```

Check if "foo" is not equal to "bar" (true):

```
<% if compare="foo" notequal="bar" %>
```

Full example of a conditional block:

```
<% if compare=<% contact field="firstname" %> equal="Bart" %>
    You're Homer's son! 
<% elseif compare=<% contact field="firstname" %> equal="Lisa" %> 
    You're Homer's elder daughter! 
<% elseif compare=<% contact field="firstname" %> equal="Maggie" %>
    You're Homer's younger daughter! 
<% else %> 
    Doh! 
<% endif %>
```

Below we use the boolean `or` in an expression. To use an `and`, just replace `or` with `and`. Internally, the `if` function checks its `and` or `or` argument for `true`.

```
<% if compare=<% contact field="firstname" %> equal="Bart" or=<% if compare=<% contact field="firstname" %> equal="Lisa" %> %> 
    You're Homer's child
<% endif %>
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.emarketeer.com/references/developer-advanced/dcl-introduction/conditionals.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
