Operators – A-script operators
The commands described here are only available when writing a standalone program.
A-script provides a wide variety of operators for performing various operations. An operator is a character that acts on a value or variable. For example, + is an operator for addition.
Arithmetic Operators in A-script
Arithmetic operators perform mathematical operations such as addition, subtraction, multiplication, and division on numbers (constants and variables).
Examples using Arithmetic operators
|
Operator |
Description |
Example |
|
+ |
Integer Addition |
V1=V2+V3 |
|
- |
Integer Subtraction |
V1=V2-V3 |
|
* |
Integer Multiplication |
V1=V2*V3 |
|
/ |
Integer Division (round down) |
V1=V2/V3 |
|
% |
Modulus |
V1=V2%5 |
|
= |
Assign a variable to be the same as a value or variable |
V1=9 |
Arithmetic Operations
Bit-wise operators in A-Script
During calculations, mathematical operations such as addition, subtraction, multiplication, and division are transferred in bit units to speed up processing. A-script uses bit-level operators to perform bit-level operations.
Examples using Bitwise operators
|
Operator |
Description |
Example |
|
>> |
Bit Shift Right |
V1=V2>>2 |
|
<< |
Bit Shift Left |
V1=V2<<2 |
|
& |
Bit-wise AND |
V1=V2&7 |
|
| |
Bit-wise OR |
V1=V2|8 |
|
~ |
Bitwise NOT |
V1=~V2 |
Bit-wise Operations
Relational Operators in A-Script
A relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0. Relational operators are used in decision-making and loops.
|
Operator |
Description |
Example |
|
= |
Equal to |
7=2 is false (0) |
|
!= |
Not equal to |
7!=2 is true (1) |
|
> |
Greater than |
7>2 is true (1) |
|
< |
Less than |
7<2 is false (0) |
|
>= |
Greater than or equal to |
7>=2 is true (1) |
|
<= |
Less than or equal to |
7<=2 is false (0) |
Relational Operations
See also:
Standalone Programming Commands
Commander Manual
2.7 Standalone program Specification