Coding Class
This topic is not available in the selected language or version. Showing the start of this section.
After reading a concept, solve an exercise, build a program, and fix an error. Each class follows exercise → program project → debugging. Start from requirements and completion criteria before consulting hints.
Roadmap exercises
Section titled “Roadmap exercises”- Exercise — choose your path: List the basic chapters from installation through testing. If you can already build a small tool, identify the first advanced chapter. Completion: explain that scope modes begin the advanced path.
- Build a program — define your first goal: Plan a file word counter, recording input files, expected counts, and a failure case. Completion:
one twogives 2, an empty file gives 0, and an absent path gives an error. Implement it in the word-counter class. - Debug — locate the failing stage: Classify “command not found,” “type mismatch,” and “runtime index out of bounds” as environment, checking, or execution problems. Choose the first diagnostic action for each. Completion: choose
command -v xen,xen check, andxen runrespectively, and explain why editing source alone cannot fix command lookup.
Basics · Build a program
Section titled “Basics · Build a program”| Class | Exercise and project focus |
|---|---|
| Installing Xen | Environment, workspace, PATH |
| Your first program | Output order, executables, source paths |
| Variables and values | Value tracing, receipts, mutability |
| Data types and conversions | Division, averages, numeric mismatches |
| Functions and control flow | Ranges, even totals, return paths |
| Strings and collections | Bytes and words, score summaries, empty input |
| Structs and enums | States, task cards, missing match branches |
| Missing values and errors | Option, input conversion, ? errors |
| Working with multiple files | Module paths, shop totals, declarations |
| Build a word counter | File boundaries, multiple files, arguments |
| Testing your code | Filters, word-count regression, endpoint bugs |
Advanced · Take control
Section titled “Advanced · Take control”Advanced practice starts with scope modes. Choose how to modify, borrow, transfer, and optimize, and check the resulting restrictions.
| Class | Exercise and project focus |
|---|---|
| Scope modes | Reference scopes, opt experiments, caller annotations |
| Copies, moves, and references | Independent copies, updates, borrow errors |
| Generics and type inference | Type arguments, fallbacks, inference errors |
| Slices and iterators | Pipeline order, box consumption, view lifetimes |
| Box and recursive data | Link termination, list length, moved owners |
Practice workflow
Section titled “Practice workflow”Use a separate file per task. Check and run ordinary programs; use xen test for test-only files. Debugging starters fail intentionally. Record the cause, fix it, and rerun the original and boundary inputs. These are self-checked exercises: use each page’s completion criteria.
Return through Read the Learn chapter when you need a concept. Classes follow the same order as the learning roadmap, so you can alternate between the tabs.