Features

What Cobalt has built in, each with a short example and what it prints.

Live values

Use <- and the value keeps itself up to date whenever what it depends on changes.

price := 20
total <- price + 2
price := 50
out total

Prints

52

Time travel

Every value remembers its history, so you can step back.

score := 10
score := 40
rewind score
out score

Prints

10

Pipes

Pass a value from one step to the next, reading top to bottom.

[50, 20, 90]
>> sort
>> map fx x => x * 10
>> out

Prints

[200, 500, 900]

Match

Compare a value against ranges, lists and patterns.

fx grade points =>
give points ? 90.. => "A"
| 80..89 => "B"
| _ => "keep going"
out grade 85

Prints

B

Watchers

Run code the moment something becomes true.

score := 0
on score >= 3 => out "three points!"
loop 5 => score += 1

Prints

three points!

Windows are built in

Add a window block and the program becomes an app. It redraws itself when a value changes.

Layout
row, column, grid, card, sidebar, nav, dialog, tabs
Content
title, text, markdown, image, table, charts, badges, progress
Controls
button, input, checkbox, switch, slider, select, file picker
Games
canvas shapes and sprites, keyboard input, game loops
Style
colours, shadows, hover states, fonts and animations
Data
save and load keep information between runs