Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

closure

A small unnamed function you can write inline and store in a variable.

A closure is an anonymous function value, written with its parameters between vertical bars, that can use variables from the scope where it is written.

Examples

  • let double = |x| x * 2; then double(21) returns 42; the compiler works out the type of x from how the closure is used.

Read the full section →