> For the complete documentation index, see [llms.txt](https://docs.ninox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ninox.com/ninox-scripting/automate-your-workflows/explore-core-scripting-elements/operators.md).

# Operators

Operators are the small symbols and keywords that make Ninox logic work. You use them to calculate totals, compare values, store results, and access data.

This page shows each operator as a symbol and by name.

That makes it easier to recognize operators here and reference them consistently in other chapters.

In this chapter, you will learn how to:

* Assign values to fields and variables
* Work with text, record fields, and structured data
* Calculate values with arithmetic operators
* Compare values and return `true` or `false`

### **Choose the right operator**

Use these operator groups for different tasks:

* **Write values and references** for assigning values, writing text, and accessing fields
* **Arithmetic operators** for totals, quantities, discounts, and other calculations
* **Comparison operators** for checks inside `if` conditions and filters

If you are just getting started, focus on `+`, `-`, `*`, `/`, `=`, `!=`, `:=`, and `.` first.

## **Write values and references**

These operators help you write valid logic, assign values, and refer to text, fields, and record data. You will use them in almost every script, even in very short ones.

<table><thead><tr><th width="189.6953125">Operator and name</th><th>What it does</th><th>Example</th></tr></thead><tbody><tr><td><code>:=</code> Assignment</td><td>Assigns a value to a variable or field.</td><td><code>let myN := 1000;</code></td></tr><tr><td><code>;</code> Semicolon</td><td>Ends a statement, especially before another one follows.</td><td><code>let myN := 1000;</code></td></tr><tr><td><code>""</code> Double quotes</td><td>Marks text as a string value.</td><td><code>"Hello" + " " + "world!"</code></td></tr><tr><td><code>.</code> Dot</td><td>Accesses a field on a record or a value in an object.</td><td><code>(select Customers).Name</code></td></tr></tbody></table>

{% hint style="success" %}
In Ninox scripting refer to field or table names with the internal name and not the label.\
Internal names must not contain any spaces or special characters and must be unique. Ninox autogenerates the internal name, but you are free to change it. For example, if the label is "First name", the autogenerated internal name will be "first\_name".
{% endhint %}

### **Assign values with `:=`**

Use `:=` to store a value in a variable or write a value into a field.

```ninox
let myN := 1000;
myN := 2;
Text := "Hello world!";
alert(Text + " We are " + myN + " Ninox users.")
```

This example does three different assignments.

* The first line creates the variable `myN` and stores the number `1000`.
* The second line updates `myN` and replaces the old value with `2`.
* The third line writes the text `Hello world!` into the field `Text`.

### **End statements with `;`**

Use `;` to separate statements.

Ninox often inserts semicolons automatically when needed, especially after `let` statements.

```ninox
let myX := 1000;
let myY := 500;
myX + myY
```

This example separates statements and combines two values.

* Ninox stores `1000` in `myX`.
* Ninox stores `500` in `myY`.
* The last line adds both values and returns `1500`.

### **Mark text with quotes**

Use double quotes for text values.

```ninox
"Hello" + " " + "world!"
```

This example joins three text values into one result.

* Each part in quotes is treated as text.
* The `+` operator joins the three text parts into one string.
* The result is `Hello world!`.

Double quotes are also useful when you build short dynamic text with field values.

```ninox
"Hello " + first_name + "!"
```

This example combines fixed text with a field value.

* `"Hello "` is fixed text.
* `first_name` reads the field value.
* `"!"` adds the closing punctuation.
* If `first_name` contains `Sam`, the result is `Hello Sam!`.

```ninox
"Your choice: " + text(choices)
```

This example combines fixed text with a number.

* `choices` returns the numeric index of the selected choice, which maps to a text value.
* `text(...)` picks the mapped text.
* The result becomes one text value such as `Your choice: Apples`.

### **Access values with `.`**

Use the dot operator to access a field from a record or a value from a structured object.

```ninox
(first(select customers)).name
```

This example reads one field from one record.

* `select customers` returns records from the "Customers" table.
* `first(...)` takes the first record from that result.
* The dot operator reads the value in the `name` field of that record.

## **Calculate values**

Use arithmetic operators to calculate values directly in your logic.

They are useful for prices, quantities, percentages, durations, and counters.

<table><thead><tr><th width="184.546875">Operator and name</th><th width="348.6171875">What it does</th><th>Example and result</th></tr></thead><tbody><tr><td><code>+</code> Plus</td><td>Adds numbers. It can also join text.</td><td><code>1 + 2</code> returns <code>3</code></td></tr><tr><td><code>-</code> Minus</td><td>Subtracts one number from another.</td><td><code>3 - 2</code> returns <code>1</code></td></tr><tr><td><code>*</code> Asterisk</td><td>Multiplies numbers.</td><td><code>2 * 3</code> returns <code>6</code></td></tr><tr><td><code>/</code> Slash</td><td>Divides one number by another.</td><td><code>6 / 3</code> returns <code>2</code></td></tr><tr><td><code>%</code> Modulo</td><td>Returns the remainder after division.</td><td><code>13 % 5</code> returns <code>3</code></td></tr><tr><td><code>()</code> Parentheses</td><td>Changes the order of calculation.</td><td><code>(1 + 2) * 3</code> returns <code>9</code></td></tr></tbody></table>

### **Use arithmetic operators in everyday logic**

These are typical use cases:

* Multiply a price by a quantity
* Add a surcharge or discount
* Divide a total across several records
* Check whether a number divides evenly with `%`

```ninox
let myTotal := price * quantity;
let myDiscounted := myTotal - discount;
```

This example calculates a value in two steps.

* The first line multiplies `price` by `quantity`.
* Ninox stores that result in `myTotal`.
* The second line subtracts `discount` from `myTotal` and stores the new result in `myDiscounted`.

### **Understand modulo**

The modulo operator `%` returns what is left after integer division.

```ninox
13 % 5
```

This example shows how modulo returns the remainder.

* Ninox divides `13` by `5`.
* The integer result is `2`, because `5` fits into `13` two times.
* After that division, `3` is left over.
* That is why the expression returns `3`.

### **Control the order of calculation**

Ninox follows standard operator precedence. Multiplication and division run before addition and subtraction.

Compare these examples:

```ninox
1 + 2 * 3
```

This example shows the default calculation order.

* Ninox does not calculate this from left to right.
* It first multiplies `2 * 3`, which gives `6`.
* It then adds `1`.
* The final result is `7`.

```ninox
(1 + 2) * 3
```

This example shows how parentheses change the calculation order.

* Ninox first adds `1 + 2`, which gives `3`.
* It then multiplies that result by `3`.
* The final result is `9`.

{% hint style="info" %}
Ninox automatically formats logic for readability. It removes unnecessary spaces and parentheses, and adds spaces where useful. The calculation result does not change as long as the logic stays equivalent.
{% endhint %}

## **Compare values**

Comparison operators check whether two values match a condition. They help Ninox decide what should happen next.

They return a Boolean result:

* `true`
* `false`

In a Yes/No field, Ninox shows these results as **Yes** and **No**.

<table><thead><tr><th width="241.41796875">Operator and name</th><th width="295.9765625">What it does</th><th>Example and result</th></tr></thead><tbody><tr><td><code>=</code> Equals</td><td>Checks whether two values are equal.</td><td><code>1 + 1 = 3 - 1</code> returns <code>true</code></td></tr><tr><td><code>!=</code> Not equal</td><td>Checks whether two values are different.</td><td><code>"Apples" != "Pears"</code> returns <code>true</code></td></tr><tr><td><code>&#x3C;</code> Less than</td><td>Checks whether the left value is smaller.</td><td><code>4 * 2 &#x3C; 10</code> returns <code>true</code></td></tr><tr><td><code>&#x3C;=</code> Less than or equal to</td><td>Checks whether the left value is smaller or equal.</td><td><code>5 * 2 &#x3C;= 10</code> returns <code>true</code></td></tr><tr><td><code>></code> Greater than</td><td>Checks whether the left value is greater.</td><td><code>10 > 4 * 2</code> returns <code>true</code></td></tr><tr><td><code>>=</code> Greater than or equal to</td><td>Checks whether the left value is greater or equal.</td><td><code>5 * 2 >= 10</code> returns <code>true</code></td></tr><tr><td><code>like</code> Like</td><td>Checks whether text contains a value.</td><td><code>"Hello" like "el"</code> returns <code>true</code></td></tr><tr><td><code>not</code> Is not</td><td>Checks if a condition is <code>false</code></td><td><code>not 1 = 3</code> returns <code>true</code></td></tr></tbody></table>

### **Use comparison results in logic**

Comparison operators are often used in `if` conditions.

```ninox
if total > 100 then
	alert("High value")
end
```

This example runs an action only when a condition is true.

* Ninox checks whether the field `total` is greater than `100`.
* If that condition is true, it shows the message `High value`.
* If the condition is false, nothing happens.

You can also compare field values directly:

```ninox
if status = "Open" then
	alert("This record still needs attention.")
end
```

This example compares a field value with a fixed text value.

* Ninox compares the field `status` with the text `Open`.
* If both values match exactly, it shows the alert.
* This pattern is useful for reminders, validation, and workflow checks.

### **Compare text with `like`**

Use `like` when you want to check whether one text value appears inside another.

```ninox
"Hello" like "el"
```

This example checks whether one text contains another text.

* Ninox checks whether the text `el` appears anywhere inside `Hello`.
* Because `Hello` contains `el`, the condition returns `true`.

```ninox
"el" like "Hello"
```

This example shows that `like` is not symmetric.

* Ninox checks whether the shorter text `el` contains `Hello`.
* That is not the case.
* The condition returns `false`.

{% hint style="info" %}
`like` checks for contained text. It does not check whether both values are identical. Use `=` when you need an exact match.
{% endhint %}

### **See operators working together**

Most real scripts combine several operators in one block.

```ninox
let myTotal := price * quantity;
if myTotal > 100 then
	alert("High-value record: " + text(myTotal))
end
```

This example combines assignment, calculation, comparison, and text output.

* The first line calculates a total and stores it in the variable `myTotal`.
* The `if` statement checks whether that total is greater than `100`.
* If it is, Ninox builds a message by joining the text `High-value record:` with the calculated total.
* `text(myTotal)` converts the number into text so it can be shown inside the alert message.

```ninox
let myFullName := first_name + " " + last_name;
if last_name != "" then
	alert("Customer: " + myFullName)
end
```

This example combines field access, text joining, assignment, and comparison.

* The first line reads the fields `first_name` and `last_name`.
* It joins both values with a space and stores the result in the variable `myFullName`.
* The `if` statement checks whether `last_name` is not empty.
* If the field contains text, Ninox shows the full name in an alert.

```ninox
let myReference := "INV-" + text(number);
reference := myReference;
```

This example combines text creation, conversion, and assignment to a field.

* The first line builds a new text value that starts with `INV-`.
* `text(number)` converts the numeric value in `number` into text.
* Ninox stores the complete result in the variable `myReference`.
* The second line writes that value into the field `reference`.

Across these examples, you can see how operators help you:

* assign values with `:=`
* join text with `+`
* calculate results with `*`
* compare values with `>` and `!=`


---

# 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://docs.ninox.com/ninox-scripting/automate-your-workflows/explore-core-scripting-elements/operators.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.
