Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
Zig w/ Example is a collection of code examples written in Zig to show the solutions to various common programming problems.
Most of these examples assume that you have some prior knowledge about the language. If you're new to the language, it's highly recommended that you read the official documentations first.
Environment Variables
File
- Create/write file
- Append data to file
- Check if a file exists
- Read file
- Read file in small chunks
- Read/write file
- Delete file
Function
JSON
- Encode into JSON
- Decode from JSON
- Decode: Handling null
- Decode: Handling duplicate/unknown key
- Decode JSON dynamically
- Validate JSON
Random Number Generator
String Handling