# Operator Precedence and Associativity

Learn about operator precedence and associativity in Notion formulas.

Notion operators have a specific operator precedence order. Operators with a higher precedence (11 being the highest) will have their logic executed before operators of lower precedence.

Operators at the same precedence level are executed either left-to-right or right-to-left, depending on their associativity.

Refer to the table below to see the precedence level and associativity of each operator.

Since parentheses `()` have the highest precedence in a Notion formula, you can use them to define a specific order of operations within any formula.

It’s also good to understand that associativity can be thought of as an implied default setting of parentheses. For example:

```.wp-block-code {
border: 0;
}

.wp-block-code > div {
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}```// Multiply has left-to-right associativity. The following are equivalent:
2 * 3 * 4 // Output: 24
(2 * 3) * 4 // Output: 24

// Exponentiation has right-to-left associativity (the "Tower Rule"). The following are equivalent:
2 ^ 3 ^ 2 // Output: 512
2 ^ (3 ^ 2) // Output: 512
``````

Certain operators cannot be chained in Notion formulas; thus, they do not have associativity. These are marked with “N/A” in the associativity column.

For example, the following formulas will not work in Notion:

``````// Invalid
1 > prop("Number") > 5

// Valid
1 > prop("Number") and prop("Number") < 5 // Output: True

---

// Invalid
1 == +true == +"1"

// Valid
1 == +true and 1 == +"1" // Output: True
``````

If you want to understand operator precedence and associativity more thoroughly, I’ll recommend reading through the Operator Precedence guide for JavaScript on MDN’s web docs: