This repository is my personal fork of Ziglings, created as a space to study and practice the Zig programming language.
The exercises, explanations, and original project structure belong to the maintainers and contributors of Ziglings.
Original project: Ziglings
Ziglings is an educational project made up of a series of small Zig programs that are intentionally incomplete or broken.
Each exercise introduces one or more concepts from the language. The goal is to inspect the code, compile it, understand the compiler errors or unexpected behavior, and then fix the program until it works as expected.
Instead of focusing only on theory, Ziglings encourages learning through practice:
read the code → compile → understand the error → fix it → run it again
The compiler messages themselves are part of the learning experience, helping you become familiar with both Zig's syntax and the way the language works.
Ziglings closely follows Zig development and may require a development build of the Zig compiler.
This fork is currently being used and tested with:
Zig 0.17.0-dev.2127+e90365cd5
Clone this repository and enter the project directory:
git clone https://github.com/viniciusnevescosta/ziglings ziglings
cd ziglingsThen run:
zig buildZiglings will guide you through the exercises and display the relevant compiler output.
| Command | Description |
|---|---|
zig build |
Runs the exercises starting from the next unfinished one |
zig build -Dn=19 |
Runs a specific exercise |
zig build -Ds=27 |
Starts from a specific exercise |
zig build -Drandom |
Picks a random exercise |
zig build -Dreset |
Runs all exercises again |
zig build -h |
Shows the available build options |
zig run exercises/001_hello.zig |
Runs an exercise directly with the Zig compiler |
| Done | # | Exercise |
|---|---|---|
| [x] | 001 | hello |
| [x] | 002 | std |
| [x] | 003 | assignment |
| [x] | 004 | arrays |
| [x] | 005 | arrays2 |
| [x] | 006 | strings |
| [x] | 007 | strings2 |
| [x] | 008 | quiz |
| [x] | 009 | if |
| [x] | 010 | if2 |
| [x] | 011 | while |
| [x] | 012 | while2 |
| [x] | 013 | while3 |
| [x] | 014 | while4 |
| [x] | 015 | for |
| [x] | 016 | for2 |
| [x] | 017 | quiz2 |
| [x] | 018 | functions |
| [x] | 019 | functions2 |
| [x] | 020 | quiz3 |
| [x] | 021 | errors |
| [x] | 022 | errors2 |
| [x] | 023 | errors3 |
| [x] | 024 | errors4 |
| [x] | 025 | errors5 |
| [x] | 026 | hello2 |
| [x] | 027 | defer |
| [x] | 028 | defer2 |
| [x] | 029 | errdefer |
| [x] | 030 | switch |
| [x] | 031 | switch2 |
| [x] | 032 | unreachable |
| [x] | 033 | iferror |
| [x] | 034 | quiz4 |
| [x] | 035 | enums |
| [ ] | 036 | enums2 |
| [ ] | 037 | structs |
| [ ] | 038 | structs2 |
| [ ] | 039 | pointers |
| [ ] | 040 | pointers2 |
| [ ] | 041 | pointers3 |
| [ ] | 042 | pointers4 |
| [ ] | 043 | pointers5 |
| [ ] | 044 | quiz5 |
| [ ] | 045 | optionals |
| [ ] | 046 | optionals2 |
| [ ] | 047 | methods |
| [ ] | 048 | methods2 |
| [ ] | 049 | quiz6 |
| [ ] | 050 | no_value |
| [ ] | 051 | values |
| [ ] | 052 | slices |
| [ ] | 053 | slices2 |
| [ ] | 054 | manypointers |
| [ ] | 055 | unions |
| [ ] | 056 | unions2 |
| [ ] | 057 | unions3 |
| [ ] | 058 | quiz7 |
| [ ] | 059 | integers |
| [ ] | 060 | floats |
| [ ] | 061 | coercions |
| [ ] | 062 | loop_expressions |
| [ ] | 063 | labels |
| [ ] | 064 | builtins |
| [ ] | 065 | builtins2 |
| [ ] | 066 | comptime |
| [ ] | 067 | comptime2 |
| [ ] | 068 | comptime3 |
| [ ] | 069 | comptime4 |
| [ ] | 070 | comptime5 |
| [ ] | 071 | comptime6 |
| [ ] | 072 | comptime7 |
| [ ] | 073 | comptime8 |
| [ ] | 074 | comptime9 |
| [ ] | 075 | quiz8 |
| [ ] | 076 | sentinels |
| [ ] | 077 | sentinels2 |
| [ ] | 078 | sentinels3 |
| [ ] | 079 | quoted_identifiers |
| [ ] | 080 | anonymous_structs |
| [ ] | 081 | anonymous_structs2 |
| [ ] | 082 | anonymous_structs3 |
| [ ] | 083 | anonymous_lists |
| [ ] | 084 | interfaces |
| [ ] | 085 | async |
| [ ] | 086 | async2 |
| [ ] | 087 | async3 |
| [ ] | 088 | async4 |
| [ ] | 089 | async5 |
| [ ] | 090 | async6 |
| [ ] | 091 | async7 |
| [ ] | 092 | async8 |
| [ ] | 093 | async9 |
| [ ] | 094 | async10 |
| [ ] | 095 | quiz_async |
| [ ] | 096 | hello_c |
| [ ] | 097 | c_math |
| [ ] | 098 | for3 |
| [ ] | 099 | memory_allocation |
| [ ] | 100 | bit_manipulation |
| [ ] | 101 | bit_manipulation2 |
| [ ] | 102 | formatting |
| [ ] | 103 | for4 |
| [ ] | 104 | for5 |
| [ ] | 105 | testing |
| [ ] | 106 | tokenization |
| [ ] | 107 | threading |
| [ ] | 108 | threading2 |
| [ ] | 109 | files |
| [ ] | 110 | files2 |
| [ ] | 111 | labeled_switch |
| [ ] | 112 | vectors |
| [ ] | 113 | quiz9 |
| [ ] | 114 | packed |
| [ ] | 115 | packed2 |
| Resource | Link |
|---|---|
| Ziglings | codeberg.org/ziglings/exercises |
| Zig | ziglang.org |
| Zig documentation | ziglang.org/documentation/master |
| Learn Zig | ziglang.org/learn |
| Zig community | ziglang.org/community |
