BOOL Notation (excerpt from classic fifth edition of C # Primer)

Source: Internet
Author: User

Just sum up what you feel is hard, ha:

(1) Var1=!var2; //(non)

(2) var1=var2&var3; //(with)

(3) Var1=var2|var3; //(OR)

(4) Var1=var2^var3; //(XOR)

The difference between "or" and "XOR" is .... var2 and VAR3 have only one value of TRUE,VAR1 is true.

The & and | Operators also have two similar operators, called conditional Boolean operators (see table 4.3).

The results of these operators are exactly the same as & and |, but there is one important difference in the way results are obtained: their performance is better. Both are the values that examine the first operand (var2 in table 4.3 above), and then operate based on the value of the operand, and may not handle the second operand at all (var3 in table 4-3).

If the first operand of the && operator is false, you do not need to consider the second operand.

BOOL Notation (excerpt from classic fifth edition of C # Primer)

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.