Builtins

Types and functions the compiler treats specially. Most are also documented in the Stdlib reference — this page is the lookup table.

Primitive types

TypeDescriptionRange / Notes
IntDefault integer typePlatform-sized signed (64-bit on most targets)
Int8 Int16 Int32 Int64Sized signed integers-2^(n-1) to 2^(n-1) - 1
UInt8 UInt16 UInt32 UInt64Sized unsigned integers0 to 2^n - 1
FloatDefault floating pointAlias for Float64
Float32 Float64IEEE-754 floatsSingle / double precision
BoolBooleantrue or false
CharUnicode scalar value32-bit, valid Unicode codepoint
StringUTF-8 stringHeap-backed, immutable
Pointer[T] RawPointerPointersFFI use only
!Never typeBottom type — see Functions → Return Types

Compiler-provided functions

A handful of names that look like functions but are compiler intrinsics:

FunctionPurpose
fatalError(message: String) -> !Abort the program with a message. Returns !.
sizeof[T]() -> IntStatic size of a type, in bytes.
alignof[T]() -> IntStatic alignment of a type, in bytes.

Use these sparingly. Most code shouldn't reach for sizeof; if it does, that's a sign you wanted FFI or generics.

Special literals

LiteralTypeNotes
42IntDecimal integer
0xFFIntHex
0b1010IntBinary
0o755IntOctal
3.14FloatFloat (the . is required)
true falseBool
'A'CharSingle-quoted character
"text"StringDouble-quoted string
"\(expr)"StringString interpolation