View all results

Operators

FQL provides a set of operators for comparing values, combining conditions, performing arithmetic, working with arrays, and controlling evaluation order. Operators are used throughout the language in expressions, filters, projections, and conditions.

Comparison

Comparison operators compare two operands and return a boolean result. They include equality (==, !=), ordering (<, <=, >, >=), containment (IN, NOT IN), pattern matching (LIKE, NOT LIKE), and regular expression matching (=~, !~).

example.fql
read-only
65 == 65 "abc" != "ABC" 1 IN [1, 2, 3] "foo" LIKE "f*"

See Comparison Operators.

Logical

Logical operators evaluate expressions according to their truth value. FQL supports && / AND, || / OR, and ! / NOT. The binary operators use short-circuit evaluation and return one of their operands rather than always returning a boolean.

example.fql
read-only
RETURN true && "value" RETURN NONE || "fallback" RETURN NOT false

See Logical Operators.

Arithmetic

Arithmetic operators perform operations on numeric operands: addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). Unary plus and minus are also supported.

example.fql
read-only
1 + 1 33 - 99 12.4 * 4.5

See Arithmetic Operators.

Range

The range operator (..) produces an array of integer values between two bounds, inclusive.

example.fql
read-only
2010..2013

See Range Operator.

Ternary

The ternary operator provides conditional evaluation. It returns one of two values depending on a boolean condition.

example.fql
read-only
u.age > 15 ? u.userId : NONE

See Ternary Operator.

Array

Array operators work with arrays and nested array structures. They include indexed access ([]), expansion ([*]), flattening ([**]), inline filtering and projection, the question mark operator ([?]), and array comparison operators (ANY, ALL, NONE).

example.fql
read-only
users[*].name values[**] values[* FILTER . > 2 LIMIT 3 RETURN . * 10] tags ANY == "fql"

See Array Operators.

Precedence

Operator precedence determines the order in which operators are evaluated. Parentheses can override the default evaluation order.

See Operator Precedence.

Where to go next