> For the complete documentation index, see [llms.txt](https://docs.origami.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origami.tech/reference/grid-language/syntax.md).

# Syntax and operators

Grid language syntax — brackets, the if-else conditional operator, boolean and math operators used in Origami Tech formulas.

Understand Origami Tech’s base logic structure used to build dynamic, rule-based trading strategies with logical conditions and data processing functions.

## Boolean operators

### `()`

Breakets can be used to combine expressions

### `x if smth else y`

Conditional operator.

Returns `x` if `smth` is True

Returns `y` if smth is False

`x`, `y`, `smth` - can be `decimal`, `function call`, `custom formula`, `math expr` or `bool`

### `<x> or <y>`

Boolean operator `or`. Returns `bool`

Any non-zero value for operands casts as True (ex: 1 → True, 0 → False)

Truth table:

| x     | y     | result |
| ----- | ----- | ------ |
| True  | True  | True   |
| True  | False | True   |
| False | True  | True   |
| False | False | False  |

### `<x> and <y>`

Boolean operator `and`. Returns `bool`

Any non-zero value for operands casts as True (ex: 1 → True, 0 → False)

Truth table:

| x     | y     | result |
| ----- | ----- | ------ |
| True  | True  | True   |
| True  | False | False  |
| False | True  | False  |
| False | False | False  |

### `<x> == <y>`

Equivalent op. Returns `bool`

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 1 | True   |
| 0 | 1 | False  |
| 1 | 0 | False  |

### `` `<x> ``

Boolean operator `and`. Returns `bool`

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 1 | False  |
| 1 | 0 | True   |
| 0 | 1 | True   |

### `<x> > <y>`

\#v1 #v2

Boolean operator `greater`. Returns `bool`

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | True   |
| 0 | 1 | False  |
| 1 | 1 | False  |

### `<x> >= <y>`

\#v1 #v2

Boolean operator `greater or equivalent`. Returns `bool`

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | True   |
| 0 | 1 | False  |
| 1 | 1 | True   |

### `<x> < <y>`

\#v1 #v2

Boolean operator `less`. Returns `bool`

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | False  |
| 0 | 1 | True   |
| 1 | 1 | False  |

### `<x> <= <y>`

\#v1 #v2

Boolean operator `less or equivalent`. Returns `bool`

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | False  |
| 0 | 1 | True   |
| 1 | 1 | True   |

## Math operators

### `()`

Breakets can be used to combine expressions

### `<x> / <y>`

Division operator. Returns `decimal`

### `<x> * <y>`

Multiplication operator. Returns `decimal`

### `<x> + <y>`

Sum operator. Returns `decimal`

### `<x> - <y>`

Subtraction operator. Returns `decimal`

### `<x> ** <y>`

Exponentiation operator. Returns `decimal`

### `<x> ^ <y>`
