Abbreviations; Precedence Among Operators - AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

Abbreviations

Instead of typing AND and BNOT in your programs, you can use some abbreviations for the logical
and bitwise operators. For example, the characters && can take the place of AND, and ~ can
replace BNOT. Use the method you are comfortable with; one way is easier to read; the other is
faster to type. The following table lists the supported logical and bitwise operators.
Logical and Bitwise Operator Abbreviations
Abbreviation Function
&&
||
^^
!

Precedence Among Operators

There is an order of precedence among the operators, as shown below. Operators with higher
precedence are evaluated first. For example, multiplication operations (*) are performed before the
BAND bitwise operation.
Operator Precedence
Level
1 (highest)
2
3
4
5
6 (lowest)
If the operators are in the same level of precedence, the equation is solved from left to right. For
example:
X = 12 / 3 * 5
Since multiplication and division are both in level 2, multiplication does not take higher precedence
over division, and X is equal to 20.
If you need to manually establish precedence for a certain operation, use parentheses to enclose the
operation. Multiple levels of precedence can be created with additional parentheses. For example:
X = ((4 + 6) / (2 + 3)) + 1
The first operations solved are (4 + 6) and (2 + 3), since these operations are enclosed by the
innermost parentheses. Next, 10 is divided by 5 in the second level of parentheses. Finally, 1 is
added, making X equal to 3.
Equations involving parentheses can become complex through many different levels of precedence.
Remember that the number of left parentheses must equal the number of right parentheses in order
for the expression to work.
Parentheses can be used to force the order of precedence. By adding parentheses around the OR
portion of the statement, as shown below, Axcess is forced to evaluate it first. In this example, the
Axcess Programming Language
Abbreviation Function
Logical And
&
Bitwise And (Band)
Logical Or
|
Bitwise Or (Bor)
Logical Xor
^
Bitwise Xor (Bxor)
Logical Not
~
Bitwise Not (Bnot)
Operators
Not, Bnot
*
/
%
+
-
<
<=
>
>=
=
<>
Band, Bor, Bxor
And, Or, Xor
Operators
51

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Axcess

Table of Contents