Primitives

These are the most basic values in the language, used to describe the smallest elements of data.

Nil

Sometimes you explicitly need to not return a value, this is when to use nil. It is also what is returned from an empty closure or a closure whose last statement is a let declaration.

const NIL = nil;
const NIL_AGAIN = {
  let foo = "foo";
}; // nil

Empty Closure

Empty closure expressions evaluate to nil.

const NIL = {}; // nil

No Return Closure

Closures that end in a let declaration implicitly return nil.

const NIL = {
  let foo = "foo";
}; // nil

Boolean

The second simplest primitive of the language, the value can only be true or false. It is used to represent data that is limited to being in one of two states.

const TRUE = true;
const FALSE = false;

Integer

Used to describe negative or positive integers.

const POSITIVE_INTEGER = 3123;    // 3123
const NEGATIVE_INTEGER = -134;    // -134

Float

Used to describe negative or positive floating-point numbers.

const POSITIVE_FLOAT = 31.23;    // 31.23
const NEGATIVE_FLOAT = -13.4;    // -13.4

String

Textual data can be represented using string primitives. Strings are denoted by an opening and closing double quotes (") character.

const TITLE = "this is my page";

An XML-like syntax for describing the render tree for your application, similar to the browser's HTML or React's JSX.

const ELEMENT = <div>Hello, World!</div>;

Last updated