Ternary operator
The ternary operator provides compact two-way value selection. It expects a boolean condition as its first operand and returns the second operand when the condition is true, or the third operand otherwise. For structured branching, patterns, or condition chains, use match.
example.fql
u.age > 15 || u.active == true ? u.userId : none
There is also a shortcut variant of the ternary operator with just two operands. This variant can be used when the expression for the boolean condition and the return value should be the same:
example.fql
u.value ? : "value is NONE, 0 or not present"
Next steps
Learn
Operators
Compare, combine, and transform values with FQL's operators.
Learn
none-Coalescing Operator
Select a fallback only when a value is none while preserving other falsy values.
Learn
Match Expressions
Select a value by matching against patterns or conditions with the match expression.
Learn
Logical Operators
Logical and, or, not operators with short-circuit evaluation and boolean conversion.