0PricingLogin
Zig Academy · Lesson

Types Are comptime Values

Treat a type like any other value.

A Type Is Just a Value

In Zig a type is not magic syntax: it is an ordinary value you can store, pass, and return. It simply lives only at compile-time. 🧠

The type of a Type Is type

Every type has the type type. So u8 is a value whose type is type, just like 5 is a value whose type is an integer.

const T: type = u8;

All lessons in this course

  1. Compile-Time vs Run-Time
  2. comptime Parameters and Values
  3. Types Are comptime Values
  4. inline for and Unrolled Loops
← Back to Zig Academy