0PricingLogin
Zig Academy · Lesson

const for Values That Never Change

Immutable bindings by default.

Bindings Start Here

In Zig, you give a value a name with a binding. The first choice you make is whether that name is allowed to change later.

Meet const

The keyword const creates a name whose value can never be reassigned. It is the safe, default way to name things in Zig.

const pi = 3.14159;

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