Fluxon Docs
Guide

Operators

Arithmetic, comparison, logical, and the special operators `??`, `.`, `..`, `|>`.

Arithmetic

+   -   *   /   %        # add, subtract, multiply, divide, remainder

+ also concatenates strings. If the operands are numbers it adds; if they are text it joins:

1 + 2          # → 3
"hel" + "lo"   # → "hello"

The type itself decides the difference — one operator, two natural behaviors.

Comparison

==  !=  <  <=  >  >=

Logical

&    # and
|    # or
!    # not — before a value: !x

Special operators

?? — null-coalesce

If the left side is nil, it gives the right side:

port = env.PORT ?? "8080"     # if PORT is missing, "8080"
name = user.name ?? "guest"

. — member access / index

Map key, list index, length:

user.name        # map key
list.0           # first element of the list
list.len         # length
m[key]           # dynamic key (via a variable)
list[i]          # computed index (via an expression)
list.(i)         # computed index through `.` — same as list[i]

.. — range

Both ends are inclusive:

1..5             # [1 2 3 4 5]

|> — pipe

Passes a value into a function, removing nested notation:

result = data |> clean |> format
# this is equivalent to: format(clean(data))

On this page