Curriculum Basics Numeric primitives exercise 5 · fill-word
Numeric primitives
Fill the missing builtin name. The line forces the integer
literal 200 to a specific runtime type (u8) — useful when
the target type isn't obvious from context. Three characters
total: @ prefix + two letters. Same as TS / Rust's keyword
for type assertions.
About this theme
TypeScript has one numeric type — number — that swallows everything from booleans to billions. Zig is the opposite: every integer width is explicit (i8, i16, i32, i64, u8, u32, usize), every float too (f32, f64). The big rule: NO IMPLICIT LOSSY conversion. Safe widening is allowed (u8 → u32, i8 → i32); but narrowing or sign-changing conversions need an explicit cast. @as(T, x) is for explicit-clarity coercion (and for forcing a comptime literal to a specific runtime type); @intCast(x) is for narrowing — the target type is inferred from context.