C # logical operators

Source: Internet
Author: User
Logical operators
Logical operators perform boolean logic on two expressions. There are three types of logical operators in C #: Bitwise, Boolean, and conditional.
The bitwise logical operators perform boolean logic on corresponding bits of two integral expressions. Valid integral types are the signed and unsigned int and long types. C #
Promotes byte to int, which is why the example in the prevous Section worked. The bitwise logical operators return a compatible integral result with each bit conforming
The boolean evaluation.
Boolean logical operators perform boolean logic upon two boolean expressions. The expression on the left is evaluated, and then the expression on the right is evaluated. Finally,
Two expressions are evaluated together in the context of the Boolean logical operator between them. They return a bool result corresponding to the type of operator used.
The conditional logical operators operate much the same way as the Boolean logical operators with one exception: when the first expression is evaluated and found to satisfy
Results of the entire expression, the second expression is not evaluated. This is efficient because it doesn't make sense to continue evaluating an expression when the result is
Already known.

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.