> 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/docs/docs_se/referens/developer-advanced/dcl-introduction/conditionals.md).

# Villkor

Villkorsfunktioner följer normal funktionssyntax och returnerar alltid en tom sträng. De kan inte användas som argument till andra funktioner. Du kan testa likhet eller olikhet. Det finns inget koncept för booleska operatorer, men du kan simulera AND genom att nästa villkor.

Kontrollera om "foo" är lika med "foo" (sant):

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

Kontrollera om "foo" är lika med "bar" (falskt):

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

Kontrollera om "foo" inte är lika med "foo" (falskt):

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

Kontrollera om "foo" inte är lika med "bar" (sant):

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

Fullständigt exempel på ett villkorsblock:

```
<% 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 %>
```

Nedan använder vi den booleska `or` i ett uttryck. För att använda en `and`, byt bara ut `or` mot `and`. Internt kontrollerar `if`-funktionen sitt `and`- eller `or`-argument för `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 dynamically by asking a question.

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

```
GET https://support.emarketeer.com/docs/docs_se/referens/developer-advanced/dcl-introduction/conditionals.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.
