| Section | Title |
|---|---|
| 1 | Hello, Zig |
| 2 | Build and Run |
| 3 | Variables and Constants |
| 4 | Printing Values |
| 5 | A Small Calculator |
| 6 | Reading Command-Line Arguments |
| 7 | A Word-Count Program |
| 8 | Exercises |
Hello, ZigThe first program in Zig is small.
Build and RunThere are two common ways to run a small Zig program.
Variables and ConstantsA program works with values. In Zig, values are usually stored in constants or variables.
Printing ValuesThe function std.debug.print writes text.
A Small CalculatorA program can compute a value before it prints it.
Reading Command-Line ArgumentsPrograms often need input.
A Word-Count ProgramA useful program reads text and counts something.
ExercisesThe programs in this chapter are small. They are meant to be changed, broken, rebuilt, and studied.