Type Inference vs Explicit Types
Let Zig infer or annotate yourself.
Two Ways to Type
When you bind a value, Zig can figure out the type for you, or you can spell it out. Both rely on Zig's strong, static type system.
Inference for Clear Values
If the value makes the type obvious, let Zig infer it. const name = "Ada" is clearly text, so no annotation is needed.
const name = "Ada";All lessons in this course
- const for Values That Never Change
- var for Mutable State
- Type Inference vs Explicit Types
- undefined and Uninitialized Memory