© Tyl Software Foundation 2019-2021
▶ ARITHMETIC FUNCTIONS REFERENCE
Arithmetic function, is a function that has two parameters (operands) left, right.
It does an arithmetic or boolean calculation, and returns the result.
Arithmetic function format:Left operand, scalar variable
An operator of arithmetic or logic type
An arithmetic or boolean operation
If
Arithmetic function format:
left OP right → result
left
right
Right operand, Tyl statement that its result is scalar variable
OP
result
If
a
and b
are the operands, than a plus operation will look like:
a + b
There are also double operators, for ex. '++', that causes the left operand to get the
result of the operation. Meaning,
Arithmetic function format (double operator):
left
will be modified.
Arithmetic function format (double operator):
left [OP][OP] right → result
If a
and b
are the operands, than a double plus operation will look like:
a ++ b
In cases where
left
and right
can't yield result from an operation,
the result will be left
.
Attention: Arithmetic operators are also used in
string concatanations and
composite numeric calculations, and their
operative result can be different from the dual operation result described
here!
All arithmetic functions are described in the following tables:
+ operator
Operands
Result
numbers
sum of numbers
strings
concatenated strings
string and non string
concatenated string representation of operands
booleans
left
OR right
++ operator
Operands
Result
left number only
left
is incremented by 1numbers
sum of numbers
strings
concatenated strings
string and non string
concatenated string representation of operands
booleans
left
OR right
- operator
Operands
Result
numbers
subtraction of numbers
booleans
left
OR NOT right
-- operator
Operands
Result
left number only
left
is decremented by 1numbers
subtraction of numbers
booleans
left
OR NOT right
* operator
Operands
Result
numbers
multiplication of numbers
booleans
left
AND right
** operator
Operands
Result
numbers
multiplication of numbers
booleans
left
AND right
/ operator
Operands
Result
numbers
if
right
is not zero - division of numbers, otherwise raises an errorbooleans
left
AND NOT right
// operator
Operands
Result
numbers
if
right
is not zero - division of numbers, otherwise raises an errorbooleans
left
AND NOT right