In Letlang, conditional branching is achieved with cond expressions.

A cond expression will evaluate the first branch whose condition is true. If none of the conditions are true, the cond expression will evaluate the default branch (else).

NB: The cond default branch is mandatory in order to always return a value.

Branch conditions are evaluated sequentially in the order they are written in the code. Once a condition evaluates to true, following conditions are ignored and not evaluated.


a := 30;

category := cond {
  a < 18 => "minor",
  a < 60 => "adult",
  else => "senior",