Data Types

Risor has a small, practical set of data types covering primitives, containers, and a few specialized types.

Primitives

Bool

Boolean values are true and false:

let active = true
let done = false

Int

Integers are 64-bit signed values:

let x = 42
let negative = -7

Integer literals can be written in decimal, hexadecimal, or binary:

0xFF     // 255 (hexadecimal)
0b1010   // 10 (binary)

Float

Floating-point numbers are 64-bit IEEE 754 values:

let pi = 3.14
let tiny = 0.001

String

Strings are immutable sequences of characters, written with double quotes or backtick template strings:

let greeting = "hello"
let message = `Hello ${name}!`

See the strings page for full details on string interpolation, indexing, and slicing.

Nil

nil represents the absence of a value:

let x = nil

Containers

List

Lists are ordered, mutable collections of values. They can hold mixed types:

let items = [1, 2, 3]
let mixed = [1, "two", true, nil]

Lists support indexing, slicing, and negative indexing. See the collections page for details.

Map

Maps are unordered collections of key-value pairs with string keys:

let person = {name: "Alice", age: 30}

Values are accessed with dot notation or bracket notation:

person.name      // "Alice"
person["age"]    // 30

Other Types

Byte

A byte represents a single byte value in the range 0-255:

let b = byte(65)   // ASCII 'A'

Bytes

A bytes value is a mutable sequence of bytes:

let data = bytes("hello")

Range

range creates a lazy sequence of integers:

let r = range(10)          // 0 through 9
list(range(5))                // [0, 1, 2, 3, 4]

Ranges are lazy. They produce values on demand rather than allocating a full list in memory.

Error

Error values represent failures and can be created with the error function:

let err = error("file %s not found", filename)

See the error handling page for full details.

Truthiness

Values in Risor follow these truthiness rules:

ValueTruthy?
trueyes
falseno
0 (int)no
non-zero intyes
0.0 (float)no
non-zero floatyes
"" (empty string)no
non-empty stringyes
nilno
empty list []no
non-empty listyes
empty map {}no
non-empty mapyes
erroryes
functionyes

These rules apply wherever a boolean is expected, such as in if conditions and logical operators.


Risor © 2026 Deep Noodle