Skip to content

Functions

fn greet name
console.log[name]

Compiles to:

function greet(name) {
console.log(name);
}
fn double x to x mul 2
function double(x) {
return x * 2;
}

Use ; to separate parameters:

fn add a; b
return a add b
function add(a, b) {
return a + b;
}
const double be fn x to x mul 2
const double = (x) => x * 2;
async fn fetch-data url
const res be await fetch[url]
return res
async function fetchData(url) {
const res = await fetch(url);
return res;
}

Use [] instead of ():

greet[///world///]
add[1; 2]
console.log[///hello///]
greet("world");
add(1, 2);
console.log("hello");
fn add a of Number; b of Number gives Number to a add b

Type annotations with of and gives are erased in the JavaScript output.

fn get-value
return 42