Expression Operator Precedence

< Previous | Contents | Manuals Home | Boris FX | Next >

โ€ŒExpression Operator Precedence

Sizzle uses a simplified operator precedence, especially compared to C++. The precedences have been adjusted to make embedding script in boilerplate easy. The operators are listed from highest to lowest.


Terms (expr), [index], ob.attr, function calls, #ob,

$indirection

Autoincrements ++x, --x, x++, xโ€”

Powers x**2

Negations -x, ~x

Multiplications x*y, x/y, x%y, x&y, x^y, x<<y, x>>y

Additions x+y, x-y, x|y

Selection (q ? x : y)

Relations x<y, x>y, x==y, x!=y, x<=y, x>=y

Boolean Negate !(x==3)

Boolean And x>y && y>z

Boolean Or x==5 || y>3

Assignments x=y, x+= y, x -= y, x *= y, x /= y, x &= y, x |= y, x ^= y

Concatenation โ€œaโ€ x=โ€bโ€ 2+3 x produces โ€œa5bโ€


All numbers are 64-bit floating point, but hexadecimal constants, logical shifts, and booleans are treated as 32-bit integers.

Note that the assignment operators do not produce output to the file, as in the concatenation example above. The mini-script @[x=โ€Hiโ€ โ€œthereโ€]@ writes โ€œthereโ€ (without the quotes) to the output file, assigning โ€œHiโ€ to the variable x. This is because concatenation is lower in the precedence table than assignment, so the assignment โ€œ=โ€ binds only to โ€œHiโ€. If you wanted x to be โ€œHi Thereโ€, you would write [@x=(โ€œHiโ€ โ€œThereโ€)]@, which would output nothing. Though this means you need parentheses for this example, the precedence above eliminates the need to end each line with a semicolon or end of line.

ยฉ2025 Boris FX, Inc.ย โ€”ย UNOFFICIALย โ€”ย Converted from original PDF.


Please select your language

The website is currently localized into the following languages