Built-in types

Browser runtime: loading…

Sapphire built-ins are regular objects: strings, numbers, booleans, lists, maps, ranges, and nil can be passed around and sent messages. Each runnable snippet uses the same WASM engine as the playground.

Core values

Sapphire includes the everyday value types you expect:

TypeExamples
Int0, 42, -7
Float3.14, -0.5
Booltrue, false
String"hello"
List[1, 2, 3]
Map{ name: "Ada", score: 95 }
Nilnil

Lists and blocks

Lists support familiar iterators: map, each, reduce, select, any?, all?, and friends. Blocks use |x| parameters.

lists.spr
Press Run to execute this snippet. ⌘↵ runs from the editor.

Maps

Map literals use { key: value }; keys are strings, and maps support the same block style for filtering and iteration.

maps.spr
Press Run to execute this snippet. ⌘↵ runs from the editor.