Unary, Binary, and List Operators and Their Precedence Rules
Table 5-1:
Unary Operators
Operator
Description
+
Unary plus
-
Unary minus
!
Logical not
The binary operators include arithmetic and logical operations.
Table 5-2:
Binary Operators
Operator
Description
+
Plus
-
Minus
*
Multiply
/
Divide
^
Power
==
Equal
!=
Not equal
>
Greater than
>=
Greater than or equal to
<
Less than
<=
Less than or equal to
&&
Logical and
||
Logical or
The following operators are used for precedence, grouping, lists, and unit definitions:
Table 5-3:
Grouping, List, AND Unit Operators
Operator
Description
()
Parentheses for controlling precedence in expressions
{}
Vector and tensor expressions
,
Element separator in lists
.
Scoping operator
[]
Unit
The following list shows the precedence order for the operators above:
Table 5-4:
Precedence Levels
Precedence Level
Symbol
Description
1
() {} .
Grouping, lists, namespace
2
^
Power
3
! - +
Unary: logical not, minus, plus
4
[ ]
Unit
5
* /
Multiplication, division
6
+ -
Addition, subtraction
7
< <= > >=
Comparisons: less than, less than or equal, more than, more than or equal
8
== !=
Comparisons: equal, not equal
9
&&
Logical and
10
||
Logical or
11
,
Element separator in lists