Zig 示例
Zig by Example

原始链接: https://github.com/boringcollege/zig-by-example

**Zig by Example** 是一个开源仓库(由 `boringcollege` 托管在 GitHub 上),它为 Zig 编程语言提供了实用的带注释入门指南。该项目受 *Go by Example* 启发,旨在通过实际的代码片段帮助开发者学习 Zig。 Zig 是一种通用的编译型系统语言,它通过消除隐藏的控制流、隐藏的内存分配和预处理器,优先考虑健壮性、最优性和简洁性。该仓库涵盖了广泛的基础主题,包括: * **核心语法:** 变量、循环、函数、结构体、枚举和指针。 * **内存与数据:** 切片、数组、内存分配以及 HashMaps 和 ArrayLists 等数据结构。 * **高级特性:** 编译期执行(Comptime)、泛型、错误处理和 C 语言互操作性。 * **实用工具:** 文件 I/O、JSON 处理、测试以及 Zig 构建系统。 这些示例已更新至 Zig 0.14 版本,可作为官方文档及 *Ziglings* 等社区项目之外的结构化学习资源。对于希望掌握该语言独特的系统编程方法的开发者来说,这是一个理想的起点。

关于“Zig by Example”的一场 Hacker News 讨论显示,人们对 Zig 编程语言的兴趣正在激增。虽然用户们分享了该代码库,但评论者指出这些资料目前已经过时,并特别提到自 Zig 0.14 版本更新以来,该语言的构建系统、C 语言互操作性以及格式化规范(常被称为“writergate”)发生了重大变化。 为了帮助有兴趣学习该语言的人,用户推荐了一些较新的资源,包括: * Karl Seguin 撰写的《Learning Zig》 * 《Zig.guide》 * Pedro Park 撰写的《Introduction to Zig》 * 《Ziglings》,一个通过练习进行实践的项目。
相关文章

原文
Skip to content

boringcollege/zig-by-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Zig by Example

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.


  1. Hello, World
  2. Values
  3. Variables
  4. Integers
  5. Floats
  6. Strings
  7. Arrays
  8. Slices
  9. Vectors
  10. Structs
  11. Enums
  12. Unions
  13. Functions
  14. Blocks and Statements
  15. If / Else
  16. Switch
  17. While Loops
  18. For Loops
  19. Defer
  20. Errors
  21. Optionals
  22. Pointers
  23. Multi-Pointers
  24. Slices (Pointers)
  25. Comptime
  26. Generics
  27. Memory Allocation
  28. ArrayList
  29. HashMap
  30. Linked List
  31. Testing
  32. Formatting and Print
  33. File I/O
  34. Processes
  35. JSON
  36. Random Numbers
  37. Sorting
  38. Math
  39. Build System
  40. C Interop

Further Reading


Zig by Example is inspired by Go by Example by Mark McGranaghan. Examples target Zig 0.14.

About

Zig by example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

联系我们 contact @ memedata.com