# Operators in X3

#### Logical Operators:

```x3
 codeExplainvar a = 5
var b = 10

if a > 0 and b > 0 then
    show("Both 'a' and 'b' are positive.")
end

if a == 5 or b == 5 then
    show("At least one of 'a' or 'b' is equal to 5.")
end

if not (a < 0) then
    show("'a' is not negative.")
end
```

* X3 supports logical operators such as "and", "or", and "not".
* These operators allow you to combine or negate conditions to create more complex expressions.

#### Comparison Operators:

```x3
 codeExplainif a == b then
    show("'a' is equal to 'b'.")
end

if a != b then
    show("'a' is not equal to 'b'.")
end

if a < b then
    show("'a' is less than 'b'.")
end

if a >= b then
    show("'a' is greater than or equal to 'b'.")
end
```

* X3 also supports comparison operators like "==" (equality), "!=" (not equal), "<" (less than), ">" (greater than), "<=" (less than or equal), and ">=" (greater than or equal).
* These operators are used to compare values and return a boolean result.

#### Combining Conditions:

```x3
 codeExplainif a > 0 and b < 10 then
    show("'a' is positive and 'b' is less than 10.")
end

if a > 0 or b < 10 then
    show("Either 'a' is positive or 'b' is less than 10.")
end
```

* You can combine multiple conditions using logical operators to form more complex conditions.

Conditions in X3 are fundamental for creating dynamic and responsive programs, allowing you to control the flow of execution based on specific criteria or inputs. By using conditions effectively, you can create programs that adapt to different situations and requirements.


---

# 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://manis-organization-2.gitbook.io/untitled-1/keywords/operators-in-x3.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.
