View all results

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
read-only
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
read-only
u.value ? : "value is NONE, 0 or not present"

Next steps