Some calculations
You know how to create a Scriptol file. This is just a text file, with commands inside, one per line.
Examples:
print
x * 2 print x + (y / 2) |
The print statement displays something on the screen, this may be a text,
a number, the result of an expression.
Expressions are mathematical or other expressions, as you will see later.
You can write such arithmetical expression as you do on paper, with parenthesis
to group sub-expression.
Result of an expression may be memorized. You have to give a name to a memory.
Example: a or b, are the name of memories. They must have a type. You declare
a memory with a type and a name, and then, you can put numbers, texts, or
results of expressions into them, according to their type...
number
a a = 1 text b b = "some text" a = x + (y / 2) |
You may declare a memory (programmers say "variable") and fill it directly
with a value or an expression.
number
a = 10 text b = "some text" number a = x + (y / 2) |
In the expression above, a, x, y are variables, a is assigned, x and y are
read.
There are other types of variables. You may specify more precisely the type
of number: integer, natural, real, boolean. Array is another type frequently
used.