0PricingLogin
Zig Academy · Lesson

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

  1. const for Values That Never Change
  2. var for Mutable State
  3. Type Inference vs Explicit Types
  4. undefined and Uninitialized Memory
← Back to Zig Academy