Erlang -- operator

Source: Internet
Author: User
Tags bitwise operators

(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
  1. :

  2. #

  3. (One dollar) +, (one dollar)-, bnot, not

  4. /, *, Div, REM, band, and

  5. +,-, Bor, bxor, BSL, BSR, Or, XOR

  6. ++ ,--

  7. =,/=, = <, <,> =, =: =, =/=

  8. Andalso

  9. Orelse

  10. =








Left to right



Right to left, that is, the list operation, is to add the left to the right






Right to left



Erlang -- operator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.