Learn Capa
A step-by-step tutorial. Twelve chapters, hands-on. Every chapter has a runnable program and a focused new idea. Read it in order on the first pass; come back as a reference later.
Before you start
You need:
- Capa installed and on your
PATH. Check withcapa --version; if not, see Get started. - A text editor. Any editor will work; for syntax highlighting and the language server, see editor integration on the install page.
- A terminal. Every chapter has a
capa --run file.capastep.
No prior capability-language experience is assumed. If you have written Python, Go, Rust, or any C-family language, you will feel at home. Where Capa is unusual is called out explicitly.
The twelve chapters
Each chapter is short (5-10 minutes of reading plus typing). You can stop after any chapter and have a working program. The capability discipline starts to bite in chapter 8; the first seven chapters are a normal-looking language so the surface stays familiar before the unusual ideas arrive. The final chapter is a worked example that exercises everything.
- Hello, Capa
- Values and types
- Functions
- Control flow
- Collections
- Structs and sum types
- Errors as values
- Your first capability
- Attenuating capabilities
- Defining your own capability
- Modules and visibility
- A small project
Once you finish (or want to look something up), the language reference and the standard library are the dense companions to this track.