Easypt

Basics

1. Hello world!

Create new *.ez source file (e.g. source.ez). Open it with VS Code. Paste following code to that file:

log("Hello world!");

Create tasks.json as described in prepare environment. Run file with Ctrl+Shift+B. You wil see output in VS Code integrated terminal, something like this:

> Executing task: D:\Easypt\bin\easypt.exe -file source.ez <

Hello world!

Press any key to close the terminal.

Congrats, you have created your first Easypt script! Alternatively you can run it from shell with command:

easypt -file source.ez

Understand the code:

In computer science, a literal is a notation for representing a fixed value in source code.

From Wikipedia

2. Comments

In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters.

From Wikipedia

Easypt support multi-line comments, all comments are ignored by Easypt interpreter. Comment start and and with hash sign (#).

Example:

# Comment in single line. #

#
Comment in three lines.
#

log("Hello", # Comment inside statement! # "world!");

3. Variables

In computer programming, a variable or scalar is a storage location (identified by a memory address) paired with an associated symbolic name (an identifier), which contains some known or unknown quantity of information referred to as a value. The variable name is the usual way to reference the stored value, in addition to referring to the variable itself, depending on the context. This separation of name and content allows the name to be used independently of the exact information it represents. The identifier in computer source code can be bound to a value during run time, and the value of the variable may thus change during the course of program execution.

From Wikipedia

In Easypt variables have names, types and values. Some types examples:

See in reference: Object, Int, Double, String.

You can create variable and assign it a value like this:

auto myText.=("This is my first variable");
var myRealNumber.=(0.99);

Understand the code:

See in reference: Object.=.

In computer programming, an automatic variable is a local variable which is allocated and deallocated automatically when program flow enters and leaves the variable’s scope. The scope is the lexical context, particularly the function or block in which a variable is defined.

From Wikipedia

In computer programming, a static variable is a variable that has been allocated “statically”, meaning that its lifetime (or “extent”) is the entire run of the program. This is in contrast to shorter-lived automatic variables […].

From Wikipedia

4. Math operators

Easypt’s Int and Double provide a rich set of methods for maths expressions.

Int:

Double:

Example:

auto a.=(2.+(5));
log(a);

a.=(a.-(1));
log(a);

a.=(a.*(2));
log(a);

a.=(a./(3));
log(a);

a.=(a.%(3));
log(a);

auto b.=(-70.0);
log(b);

b.=(b./(3.0));
log(b);

5. Increment and decrement

Increment and decrement operators are unary operators that add or subtract one from their operand, respectively. They are commonly implemented in imperative programming languages.

From Wikipedia

Basically (for Int and Double numbers) x.++() is equivalent of x.=(x.+(1)). Example:

auto a.=(6);
a.++();
log(a);
log(a.--());

Understand the code:

See in reference: Int.++

6. Adding Strings

The + method adds them together to make a new String.

auto text.=("Hello");
log(text.+(" world!"));

See in reference: String.+


Next lesson (Arrays)

Table of contents