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:
| Type | Examples |
|---|---|
Int | 0, 42, -7 |
Float | 3.14, -0.5 |
Bool | true, false |
String | "hello" |
List | [1, 2, 3] |
Map | { name: "Ada", score: 95 } |
Nil | nil |
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.