Skip to main content

Fibonacci

Recursion, an if-expression, and string interpolation — everything is an expression in Lux.

Open in the playground (full editor) →

Walkthrough

  • Everything is an expression: the if/else is the function body, and each branch yields the value — no return needed.
  • Type annotations (n: int, -> int) are optional everywhere; they are shown here for documentation. Inference fills them in when omitted.
  • String interpolation embeds any expression: "fib(20) = {fib(20)}".