> For the complete documentation index, see [llms.txt](https://ola-foundation.gitbook.io/ola-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ola-foundation.gitbook.io/ola-lang/ola-language/operators.md).

# Operators

Ola Provides operators such as arithmetic, logic, relational, bits, and so on. Except for the arithmetic operation acting on numerical values, which is Mod p, all others are standard semantics.

## Arithmetic operators

All arithmetic operators are Mod p.

Arithmetic operators can be combined with the assignment operator`=`to form new compound operators `+=`、`-=`、`*=`、`/=`、`%=`, with arithmetic operators having higher priority than compound operators.

| Operat | Example |                 Explanation                |
| :----: | :-----: | :----------------------------------------: |
|    +   |  a + b  |        Arithmetic addition modulo p        |
|    -   |   a-b   |       Arithmetic subtraction modulo p      |
|   \*   |  a \* b |     Arithmetic multiplication modulo p     |
|    /   |  a / b  | Arithmetic multiplication inverse modulo p |
|    %   |   a%b   |  The modulo of arithmetic integer division |
|  \*\*  |  a\*\*b |               Power modulo p               |

## Boolean operators

Support with AND(`&&`)as well as OR(`||`),with the latter having higher priority.

| Operator | Example  | Explanation                |
| -------- | -------- | -------------------------- |
| &&       | a && b   | Boolean operator and (AND) |
| \|\|     | a \|\| b | Boolean operator or (OR)   |
| !        | ! a      | Boolean operator NEGATION  |

## Relational operators

The return result of the relational operator is type`bool`

| Operator | Example | Explanation              |
| -------- | ------- | ------------------------ |
| ==       | a == b  | equal                    |
| !=       | a ！= b  | not equal                |
| <        | a < b   | less than                |
| >        | a >b    | greater than             |
| <=       | a <= b  | less than or equal to    |
| >=       | a >= b  | greater than or equal to |

## Bitwise operators

All bitwise operators are modulo p, containing bit or and non and shift operations.

| Operator | Example | Explanation        |
| -------- | ------- | ------------------ |
| &        | a & b   | bit and            |
| \|       | a \| b  | bit or             |
| ^        | a ^ b   | XOR 32 bits        |
| <<       | a << 3  | shift left         |
| >>       | a >> 3  | shift right        |
| \~       | \~a     | Complement 32 bits |

Bitwise operators can be combined with the assignment operator`=`to form the new compound operators`&=`、`|=`、`^=`、`<<=`、`>>=`, with bitwise operators taking precedence over compound operators.


---

# 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://ola-foundation.gitbook.io/ola-lang/ola-language/operators.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.
