Examples
These examples are built and tested with Roc nightly-2026-08-12-606470f.
Their source comes from roc-lang/examples at 54ed685.
- Hello, World!
- FizzBuzz
- All Syntax in 1 File
- Tuples
- Pattern Matching on Lists
- Error Handling Basic (Try)
- Error Handling Real World (Try)
- Basic Dict Usage
- Import Files
- Import from Directory
- Import Package from Module
- Multiple Roc Files
- JSON
- Terminal Commands
- Random Numbers
- CLI Args Simple
- CLI Args File
?Operator Desugaring- Safe Math
- Graph Traversal
- Parser
- Looping Effectful Functions
- Snake Game
- Record Builder
- Encoding & Decoding
- Custom Inspect
- Least Squares
- Towers of Hanoi