Examples

Whole programs, start to finish.

A handful of complete programs, from a one-line hello world to a reactive counter, a live HTTP request and an animated value. Each is real Program source.

Hello, World

Print a single line to the console.

Console.Line "Hello, World!"

Add two numbers

Add two integers and print the result. Each step is its own binding.

LET Maths.Integer sum = Maths.Integer.Add 2 3
LET Text sumText = Maths.Integer.ToString sum
Console.Line sumText

Counter

A reactive counter. The label is derived from the state, and the buttons write it. The screen follows on its own.

STATE int count = 0
LET Text countText = Maths.Integer.ToString count

UiContent.Title "Counter"
UiContent.Text "Count: " countText
UiButton.IntegerIncrement count
  UiContent.Text "Increment"
UiButton.IntegerDecrement count
  UiContent.Text "Decrement"

Fetch a URL

Request a URL and print the response body. The request is an ordinary reactive value, no promise to await.

LET Network.Web.Response response = Network.Web.Client.Get "https://httpbin.org/get" null
LET Text body = Network.Web.Response.GetResponseBody response
Console.Line body

Animate a value

Animate a real number from 0 to 100 over five seconds, printing it as it moves.

LET Maths.Real value = Animate.Real 0.0 100.0 5000.0 0.0 0.0
LET Maths.Real current = Reactive.Value value
LET Text text = Maths.Real.ToString current
Console.Line text

Write your own

Scaffold a project and run it with the toolchain from Download, and reach for any keyword on the language page.