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
- Compile-Time vs Run-Time
- comptime Parameters and Values
- Types Are comptime Values
- inline for and Unrolled Loops