< 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.