Operator precedence
The operator precedence in FQL is listed below from lowest to highest. This order follows the FQL grammar; do not assume unary and comparison operators have the same relative order as another language.
=,+=,-=,*=,/=assignment and compound assignment? :ternary operator??none-coalescing operator||logical or&&logical and!,+,-logical negation, unary plus, unary minuslike,not likepattern matchingin,not incontainmentall,any,nonearray comparison operators==,!=,<,<=,>=,>comparison operators=~,!~regular expression matching+,-addition, subtraction*,/,%multiplication, division, modulus..range and primary expressions()function call?.optional chaining.member access[]indexed value access
Operators higher in this list bind more tightly. For example, multiplication is evaluated before addition, logical and before logical or, and comparisons before unary and logical operators.
Using parentheses
Parentheses ( and ) group expressions. Use them when the intended grouping differs from the precedence rules. Most binary operators associate to the left; ?? associates to the right, so a ?? b ?? c means a ?? (b ?? c).
The formatter removes grouping that does not affect syntax or semantics. For example, it writes 1 + (2 * 3) as 1 + 2 * 3, but keeps (1 + 2) * 3, a - (b - c), and (a ?? b) ?? c. It also keeps parentheses required by grammar boundaries, recovery-tail ownership, comments, or lexical safety such as -(-value).