Data types
You can declare a type for a variable or function arguments in a syntax like
a: type or
fn f(a: type) -> type.
type can be one of:
- f64
- f32
- i64
- i32
- str
- [type] - declares an array of some other types. Can be nested like [[i32]].
Note that the language is still dynamically typed (although type checker can be run statically), so the type coercion only happens when you assign a value to a typed variable or typed function argument.
Built-in functions
As an experimental language, it has only few Built-in functions.
- print(s, ...) - Prints arguments to the output and a newline.
- puts(s, ...) - Prints arguments without a newline.
- type(obj) -> str - Returns a string representing type of given object.
- len(a: [any]) -> i64 - Returns length of a given array.
- push(a: [any], val: any) - Puts an element at the end of the array, expanding its length by 1.
- resize(a: [any], new_len: any) - Resize the array with a new length (any numeric type), filling additional elements with 0 if expanded.
- hex_string(value: i64) - Converts an integer to 2-digit hexadecimal representation string.
- set_fill_style(style) - Sets style for painting on the canvas.
- rectangle(x: i64, y: i64, width: i64, height: i64) - Draws a filled rectangle on the canvas.
Time measurement resolution
Due to security reasons, your browser may have reduced time resolution for measurement. It is typically 0.1ms or 1ms, but can be larger. Please be aware that the lower digits may be always 0 because of this rounding. See
this page for details.