Home Technology Zig by Example
Technology

Zig by Example

Key Points

A hands-on introduction to Zig via annotated examples. Zig is a general-purpose, compiled systems language focused on robustness, optimality, and simplicity — no hidden control flow, no hidden allocations, no preprocessor. Written by Dariush Abbasi for Boring College - Hello, World - Values - Variables - Integers - Floats - Strings - Arrays - Slices - Vectors - Structs - Enums - Unions - Functions - Blocks and Statements - If / Else - Switch - While Loops - For Loops - Defer - Errors -...

A hands-on introduction to Zig via annotated examples. Zig is a general-purpose, compiled systems language focused on robustness, optimality, and simplicity — no hidden control flow, no hidden allocations, no preprocessor. Written by Dariush Abbasi for Boring College - Hello, World - Values - Variables - Integers - Floats - Strings - Arrays - Slices - Vectors - Structs - Enums - Unions - Functions - Blocks and Statements - If / Else - Switch - While Loops - For Loops - Defer - Errors - Optionals - Pointers - Multi-Pointers - Slices (Pointers) - Comptime - Generics - Memory Allocation - ArrayList - HashMap - Linked List - Testing - Formatting and Print - File I/O - Processes - JSON - Random Numbers - Sorting - Math - Build System - C Interop Zig by Example is inspired by Go by Example by Mark McGranaghan. Examples target Zig 0.14. Contributions welcome — see CONTRIBUTING.md.
Dariush Abbasi (PERSON) Mark McGranaghan (PERSON)
Originally published by Hacker News Read original →