Skip to content

Basic Types

Zeen has 16 builtin types: signed ints, unsigned ints, floats, bool, char, void, never.

Length Signed Unsigned
8-bit i8 u8
16-bit i16 u16
32-bit i32 u32
64-bit i64 u64
pointer-sized isize usize

Default integer literal type is i32.

Type Description
f32 32-bit float
f64 64-bit float

Default float literal type is f64.

Type Description
bool true or false
char Single character ('a')
void No value (use @void() to make one)
never Never returns (e.g. @panic)

typeof EXPR takes the type of an expression without executing it. Combined with @typename it names the type:

let func: typeof hello = hello;
@println("{}", @typename(typeof 123));

Implicit casts happen right in expression.
Explicit casts use @as:

let a = @as(u8, 123);
From To
int / float literal concrete int / float
*T *const T
*T *void (and back)
"literal" []const char, [*]const char
fn Fn, FnOnce
Fn FnOnce
never any (e.g. @panic in expression)
From To
numeric numeric (int/float)
bool, char integer (and back)
pointer pointer, integer, fn
fn pointer
integer enum (empty-only)