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:
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.
- dbg(s) - Prints the argument value in a debugging form.
- puts(s, ...) - Prints arguments without a newline.
- type(obj) -> str - Returns a string representing type of given object.
- 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: f64, y: f64, width: f64, height: f64) - 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.