Your First Solar Script

Your first steps into Solar should be getting used to the syntax. We will make a script that that does basic math.

Math

1 + 1;
2 - 1;
4 * 4;
18 / 3;

Solar will allow you to execute simple expressions with ease.

Using Variables

let x = 3;
3 + x;

Variables allow you to store and modify data.

Using Functions

let example = fn()
{
    return 3;
};

example();

Functions make blocks of code to execute later, and can be called with arguments.

let example_two = fn(x)
{
    return x + 3;
};

example_two(6);

Using Classes

class Example
{
    let member = 3;

    let function = fn(x)
    {
        member += x;
        return member
    };
};

let instance = new Example;

instance.function(8);
instance.member;

Using classes allows you to structure variables in a clean and organized way, and allows creation on instances of the classes.