x-lang

← Index

x/core/control

if

Conditional: evaluate test, then branch.

Parameters:

Examples:

(if (> 3 2) "yes" "no") => "yes"

See also: match cond

let

Bind local variables and evaluate body.

Named let: (let name ((var init) …) body) creates a loop.

Parameters:

Examples:

(let ((x 1) (y 2)) (+ x y)) => 3
(let loop ((n 5) (acc 1)) (if (= n 0) acc (loop (- n 1) (* acc n)))) => 120

See also: letrec