Skip to main content
Skip table of contents

Operators

This page lists all the operators available in the language for use to process data. With except to the assignment operator, all of them operate on the scalar values (strings, numbers).

In order to allow for table/matrix operations, looping must be employed to iterate over all keys of the table and processing it’s values one by one.

ASTER does not provide an inequality operator (similar to <> or != known from other approaches). This is a conscious design decision coming from how the language interpreter operates internally.

To compare for inequality, please use the NOT operator and relevant value equality operator == or $==. E.g. to check that variable A does not equal to string “ABC” write NOT(A $== 'ABC')

Operator

Role

Example

,

List collecting operator
also used as function argument separator

A=(3,2,1)
# equals to
# A[1] = 3; A[2] = 2; A[3] = 1

;

Operation separator
returns the value of last operation

# separates steps of execution
A=3;B=2;C=A*B # sets C, evals to 6

=

Assignment done by value copy
also copies complete lists and tables

A = 2 # sets A to 2, evals to 2

+=

Numeric addition in-place

A=2; A+=2 # evals to 4, A updated

-=

Numeric subtraction in-place

A=3; A-=1 # evals to 2, A updated

*=

Numeric multiplication in-place

A=2; A*=2 # evals to 4, A updated

/=

Numeric division in-place

A=9; A/=3 # evals to 3, A updated

%=

Numeric modulo (reminder) in-place

A=5; A%=3 # evals to 2, A updated

&=

String concatenation in-place

A="A"; A&="B" # evals to “AB”
# A updated

+

Numeric addition

2+2 # evals to 4

-

Numeric subtraction

3-1 # evals to 2

*

Numeric multiplication

2*2 # evals to 4

/

Numeric division

9/3 # evals to 3

%

Numeric modulo (reminder)

5%3 # evals to 2

()

Grouping, function parameters

e.g. Function(param1, param2)

[]

Table / List indexing operator

A[2][1] # returns element
A[2]["FIELD"] = "value" # assignment

\

Alternative indexing operator
only for reading, not for assigning

A\2\1 # returns element
value = A\2\1 # reading only!
value = A\1\"OFF" # reading only!

{}

Dynamic symbol name operator

{"A"}[2][1] # evals to A[2][1]

{} (in texts)

Inline processing operator

Allows to mixin expressions within strings avoiding the sometimes superfluous usage of string concatenation operator &

Use the string escape character \ to avoid processing

A=1234;
"0" & A & "56"; # evals to 0123456
"0{A}56"; # evals to 0123456

"AB\{CD\{EF\}" # evals to AB{CD{EF}

AND

Logical AND

(2>3) AND (2<3) # evals to false

OR

Logical OR

'X' OR (3<1) # evals to true

NOT

Logical negation

NOT 'X' # evals to false

|AND

Short circuiting AND
evals only left argument if that is sufficient

(2>3) |AND ((A=2)>1) # evals false
# Assignment to A will not be done!

|OR

Short circuiting OR
evals only left argument if that is sufficient

(3>2) |OR ((A=2)>1) # evals true
# Assignment to A will not be done!

NAND

Logical AND negated

(2>3) NAND (2<3) # evals to true

NOR

Logical OR negated

'X' NOR (3<1) # evals to false

XOR

Logical Exclusive OR

'X' XOR (3<1) # evals to true

EQL

Deep comparison of two values - compares values, lists, lists of list and so on for functional equality.
If two items are deeply equal it means that passing them to the same program will return the same result.

A[1]=123;
A[2]=123;
B[1]=123;
B[2]=123;
A EQL B; # evals to true

IN

Check if element is contained in list, using deep comparison.

A[1]=3;
A[2]=5;
A[3]=7;
2 IN A; # evals to false
3 IN A; # evals to true

==

Numeric equality

3 == 3 # evals to true

>=

Numeric greater or equal

3 >= 3 # evals to true

>

Numeric greater

3 > 1 # evals to true

<

Numeric less

2 < 5 # evals to true

<=

Numeric less or equal

3 <= 3 # evals to true

&

String concatenation

“A” & “B” # evals to “AB”

$==

String equal

“A” $== “A” # evals to true

$>=

String greater or equal

“A” $>= “A” # evals to true

$>

String greater

“A” $> “B” # evals to true

$<

String less

“B” $< “A” # evals to true

$<=

String less or equal

“A” $<= “A” # evals to true

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.