When you operate in each expression, each part of the operation is evaluated in a certain order, which is the order of precedence of the operation, also called the precedence of the operator.
In an expression, if there is more than one operator, the arithmetic operator is processed first, then the comparison operator, and finally the logical operator. In the same operator, the monocular operator has precedence over the binocular operator. Operators with the same precedence, treated in left-to-right order (except for operations).
The string concatenation operator (&) is not an operator, but for its precedence, it is ranked after all arithmetic operators, and before all comparison operators.
You can also use parentheses to change the finite order, forcing certain parts of the command expression to execute preferentially. The symbols inside the parentheses have precedence over the operators outside the parentheses, and the operator precedence in the same bracket does not change, using parentheses eliminates the hassle of rote operator precedence and facilitates readability and maintainability of the program.
The following table is the precedence order for each operator.
Arithmetic, binary, and connection operators |
Comparison operators |
logical operators |
Find the sign (^) |
Equal sign (=) |
Not |
Minus SIGN (-) |
Unequal number (<>) |
and |
Division Number (*,/) |
Less Than (<) |
Or |
Integer division number (\) |
Greater than (>) |
Xor |
Claim number (MOD) |
Less than or equal to (<=) |
|
Plus minus sign (+,-) |
Greater than or equal to (>=) |
|
Binary operator (BITNOT,BITAND,BITOR,BITXOR) |
Like,is |
|
Connection operators (&) |
|
|