Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

Runnable Crush programs. Every program and every output block on these pages is executed against crush-ast dc0d0278 by scripts/check-examples.py, so what you read is what happens. Pages also record where a language feature is not yet implemented, with the crush-ast ticket.

ExamplePatternFlags to run it
Fibonacci & FunctionsRecursion, typed signatures—
Arrays & LoopsArrays, for, break/continue, FizzBuzz—
Exception Handlingtry/catch/throw—
Structs (and Concurrency)Structs with methods; spawn/await—
Lambdas & Pipes|> pipelines, lambdas, closures—
Import StylesEvery import form, and why none loads yet—
System Info Reportenv.*, time.* capabilities--env --time
Build Pipelineprocess.exec, fail-fast steps--process
Polyglot PipelinePython + JavaScript + Bash in one program--polyglot
Showcase: awesome-crushGames, interpreters and an agent tool written by LLMsvaries

The verified corpus has 120+ more, one small program per behaviour, each with its exact output.

Run any of them with crush run [flags] file.crush (see Getting Started).