Classes

Description

Class definitions are started with they keyword class, followed by a name, which is then followed with a block of let statements. Class instances are created with the new keyword and the name of a class definition. Class instance members can be accessed using the . operator.

Example

class Example
{

    let number = 3;

    let add = fn(x)
    {
        number += x;
    };

};

let instance = new Example;
instance.add(6);

instance.number; // Returns 9.