Data types

Every value in XS has a type; the built-in ones cover the full range from scalars to collections.

Summary

Integers are 64-bit signed and promote automatically to arbitrary-precision bigints on overflow. Floats are IEEE 754 double-precision. Strings accept single or double quotes. Arrays, tuples, maps, ranges, and regexes are all first-class. The type() function returns the lowercase type name at runtime.

Canonical

TypeLiteralExample
Integer (i64)decimal, hex, binary, octal42, 0xFF, 0b1010, 0o77
Float (f64)decimal, scientific3.14, 1e10, 2.5e-3
Booleantrue, falsetrue
Stringdouble/single quoted"hello", 'world'
Nullnullnull
Arraybrackets[1, 2, 3]
Tupleparentheses(1, "a", true)
Maphash-braces#{"key": "value"}
Rangedots0..10, 1..=5
Regexforward slashes/[0-9]+/
Functionfn keywordfn(x) { x + 1 }
println(type(42))        -- int
println(type(3.14))      -- float
println(type("hi"))      -- str
println(type(true))      -- bool
println(type(null))      -- null
println(type([]))        -- array
println(type(#{}))       -- map
println(type((1, 2)))    -- tuple
println(type(0..5))      -- range
println(type(/abc/))     -- re