(1) Erlang OPERATOR:
1. Arithmetic Operators: +,-, *,/, Div, REM,
1. "/", used for division, but the result is always a floating point, that is, whether or not the Division
2. Div, division, and integer part of the result
3. REM, modulo
2. Comparison operators:>, <, >=, = <, ==, =: =,/=, =/=
1. = <, less than or equal
2, =, compare whether two values are equal, eg: 1 = 1.0. The result is: True.
3, =: =, compare whether two values are equal, and the types of the two objects must be equal, eg: 1 =: = 1.0. The result is: false.
4,/=, not equal, eg: 1/= 1.0. The result is: false.
5, =/=, incomplete, etc., eg: 1 =/= 1.0, the result is: True
3. bitwise operators: band, Bor, bnot, bxor, BSL, BSR
1. Band, bit and
2. Bor, bit or
3. bnot, non-bits
4. bxor, by bit or
5. BSL: shifts left by bit. For example: 1 BSL 5. %, 1 is shifted to 5 places. The result is 32.
6. BSR, right shift by bit
4. logical operators: (expressions on both sides of the operators are calculated)
1. Not, non-logical
2. And, logic and
3. Or, logical or
4. XOR, logic exclusive or
5. Short-circuit logic operator: (if the first part can produce the result, no other expression will be calculated)
1. andalso, X andalso Y. If X is true, Y is executed. If X is false, Y is not calculated. False is used directly.
2. orelse, X orelse Y. If X is true, the result is true, and Y is not calculated.
6. Operator priority:
Operator
|
Associativity
|
:
#
(One dollar) +, (one dollar)-, bnot, not
/, *, Div, REM, band, and
+,-, Bor, bxor, BSL, BSR, Or, XOR
++ ,--
=,/=, = <, <,> =, =: =, =/=
Andalso
Orelse
=
|
Left to right
Right to left, that is, the list operation, is to add the left to the right
Right to left
|
Erlang -- operator